From 3c4a882af448d33c9dc1edfea431894e3187595b Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 2 Oct 2023 01:19:29 +0900 Subject: [PATCH] Save up Modula 2 ... for when I reduce language in the future. #136 --- src/code-gen-pool.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/code-gen-pool.rb b/src/code-gen-pool.rb index 87c96730..fac7fddc 100644 --- a/src/code-gen-pool.rb +++ b/src/code-gen-pool.rb @@ -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"