Add string literals

This commit is contained in:
2025-09-05 17:17:28 +02:00
parent 4888252274
commit e0ac57dc1d
11 changed files with 2723 additions and 67 deletions

View File

@@ -6,8 +6,6 @@
require 'open3'
require 'rake/clean'
SYSROOT = '../eugenios/build/sysroot'
QEMU = 'qemu-riscv32'
STAGES = Dir.glob('boot/stage*.elna').collect { |stage| File.basename stage, '.elna' }.sort
CLEAN.include 'build/boot', 'build/valid'
@@ -19,6 +17,10 @@ def compile(input, output)
sh ENV.fetch('CC', 'gcc'), '-nostdlib', '-o', output, input
end
def run(exe)
ENV.fetch('QEMU', '').split << exe
end
task default: :boot
desc 'Final stage'
@@ -31,9 +33,8 @@ task boot: "boot/#{STAGES.last}.elna" do |t|
source = groupped['.elna']
cat_arguments = ['cat', source]
compiler_arguments = [QEMU, '-L', SYSROOT, exe]
diff_arguments = ['diff', '-Nur', '--text', expected, '-']
Open3.pipeline(cat_arguments, compiler_arguments, diff_arguments)
Open3.pipeline(cat_arguments, run(exe), diff_arguments)
end
desc 'Convert previous stage language into the current stage language'
@@ -60,8 +61,7 @@ STAGES.each do |stage|
exe, source = t.prerequisites
cat_arguments = ['cat', source]
compiler_arguments = [QEMU, '-L', SYSROOT, exe]
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe))
IO.copy_stream last_stdout, t.name
end
@@ -70,8 +70,7 @@ STAGES.each do |stage|
exe, source = t.prerequisites
cat_arguments = ['cat', source]
compiler_arguments = [QEMU, '-L', SYSROOT, exe]
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe))
IO.copy_stream last_stdout, t.name
end
@@ -85,8 +84,7 @@ file 'build/valid/stage1.s' => ['build/boot/stage1', 'boot/stage1.s', 'build/val
source, exe, = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.s' }
cat_arguments = ['cat', *source]
compiler_arguments = [QEMU, '-L', SYSROOT, *exe]
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe.first))
IO.copy_stream last_stdout, t.name
end