Transpile procedures and statements

This commit is contained in:
2025-05-29 00:24:52 +02:00
parent 24651e7c48
commit 192e7e40c8
3 changed files with 521 additions and 250 deletions

View File

@ -100,13 +100,15 @@ task :backport do
source = File.read source_path
target = source
.gsub(/^(var|type|const)/) { |match| match.upcase }
.gsub(/^(var|type|const|begin)/) { |match| match.upcase }
.gsub(/^[[:alnum:]]* ?module/) { |match| match.upcase }
.gsub(/(record| pointer to )/) { |match| match.upcase }
.gsub(/\brecord\b/) { |match| match.upcase }
.gsub(/proc(\(| )/, 'PROCEDURE\1')
.gsub(/([[:space:]]*)end;/, '\1END;')
.gsub(/([[:space:]]*)end(;?)$/, '\1END\2')
.gsub(/^([[:space:]]*)(while|return|if)\b/) { |match| match.upcase }
.gsub(/^from ([[:alnum:]]+) import/, 'FROM \1 IMPORT')
.gsub(/ \^([[:alnum:]])/, ' POINTER TO \1')
.gsub(/(then|do)$/) { |match| match.upcase }
target_path = Pathname.new('boot/stage1/source') + source_path.basename
File.write target_path, target