From: Michael D. Lowis Date: Tue, 23 Jun 2020 03:23:24 +0000 (-0400) Subject: checkpoint commit X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=8ef8160f8116fef76dbb70684c23cacbea788e65;p=proto%2Fsclpl-rb.git checkpoint commit --- diff --git a/dyn.rb b/dyn.rb index beecb49..cb4aec7 100755 --- a/dyn.rb +++ b/dyn.rb @@ -354,12 +354,7 @@ class CodeGenerator @syms = Symtable.new @funcs = { toplevel: { freevars: [], code: StringIO.new } } @protos = StringIO.new - @protos.print "Value " - defs.each do |k,v| - @syms[k] = :toplevel - @protos.print "#{k}, " - end - @protos.puts "_;" + @protos.puts "Value #{defs.keys.join(", ")};" exprs.each {|e| emit(e) } end @@ -386,7 +381,7 @@ class CodeGenerator end def dump - pp @syms + #pp @syms puts @protos.string end @@ -422,12 +417,9 @@ parse = Parser.new("dyn.src") defs, exprs = parse.toplevel # Print the definition prototypes -print "Value " -defs.each {|k,v| print "#{k.to_s}, " } -puts "_;" - -puts exprs +#puts "Value #{defs.keys.join(", ")};" +#puts exprs #puts exprs -#gen = CodeGenerator.new(defs, exprs) -#gen.dump +gen = CodeGenerator.new(defs, exprs) +gen.dump diff --git a/dyn.src b/dyn.src index e91d4d0..999310b 100644 --- a/dyn.src +++ b/dyn.src @@ -6,6 +6,7 @@ false 123.0 "foo" a = 1 + #[1,2,3] #{ "foo": 123, 42: 24 } # @@ -27,6 +28,7 @@ a = 1 ## functions and application #println("foo!") #print(1,2,3,4,5,6,7,8,9) + foo1 = fun(a) println("hi!") end