From be06fc096aa28358914bd6a76b4ea380a04b8873 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 15 Jul 2018 19:41:22 -0700 Subject: Major changes to how versioning and parsing work. This should be a better path going forward to handling upgrades. Old syntax files will stick around for compatibility purposes. Old syntax can be parsed into valid syntax trees via the old syntax (.peg) files, and then old syntax trees should be valid and can be upgraded via the normal code path. This change has lots of improvements to Nomsu codegen too. --- core/metaprogramming.nom | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/metaprogramming.nom') diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index d445737..2be7132 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This File contains actions for making actions and compile-time actions and some helper functions to make that easier. @@ -186,6 +187,8 @@ compile [remove free vars %vars from %code] to compile [%lua <-write %code, to %lua write %code] to: Lua "\(%lua as lua expr):append(\(%code as lua expr));" +compile [to %lua write %code joined by %glue] to: Lua "\(%lua as lua expr):concat_append(\(%code as lua expr), \(%glue as lua expr));" + compile [quote %s] to Lua value ".." repr(\(%s as lua expr)) @@ -212,7 +215,7 @@ compile [compile %block, compiled %block, %block compiled] to # Return statement is wrapped in a do..end block because Lua is unhappy if you put code after a return statement, unless you wrap it in a block. compile [return] to: Lua "do return; end" -compile [return %return_value] to: Lua "do return \(%return_value as lua expr); end" +compile [return %return_value] to: Lua "do return \(%return_value as lua expr) end" # Literals compile [yes] to: Lua value "true" -- cgit v1.2.3