Skip to content

Commit

Permalink
Save up Modula 2
Browse files Browse the repository at this point in the history
... for when I reduce language in the future. #136
  • Loading branch information
mame committed Oct 1, 2023
1 parent 880a006 commit 3c4a882
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/code-gen-pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ class Execline < CodeGen
Code = %q(%(echo "#{e[PREV]}"))
end

class Modula2 < CodeGen
Name = "Modula-2"
File = "QR.mod"
Cmd = "gm2 -fiso QR.mod -o QR && ./QR > OUTFILE"
Apt = "gm2"
def code
<<-'END'.lines.map {|l| l.strip }.join
"
MODULE QR;
FROM StrIO IMPORT WriteString;
BEGIN #{
(PREV).gsub(/()[#{i=94.chr}"]+|[#{i}']+/){
["WriteString(",$&,");"]*($1??":?')
}
}END QR.
"
END
end
end

class Pike < CodeGen
File = "QR.pike"
Cmd = "pike QR.pike > OUTFILE"
Expand Down

0 comments on commit 3c4a882

Please sign in to comment.