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/collections.nom | 1 + core/control_flow.nom | 1 + core/coroutines.nom | 1 + core/errors.nom | 1 + core/io.nom | 1 + core/math.nom | 1 + core/metaprogramming.nom | 5 ++++- core/operators.nom | 1 + core/scopes.nom | 4 ++++ core/text.nom | 1 + 10 files changed, 16 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/collections.nom b/core/collections.nom index 94fc02c..ce3f61e 100644 --- a/core/collections.nom +++ b/core/collections.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains code that supports manipulating and using collections like lists and dictionaries. diff --git a/core/control_flow.nom b/core/control_flow.nom index a3fd5a0..5de062d 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains compile-time actions that define basic control flow structures like "if" statements and loops. diff --git a/core/coroutines.nom b/core/coroutines.nom index d0d9c36..8a1f8c9 100644 --- a/core/coroutines.nom +++ b/core/coroutines.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file defines the code that creates and manipulates coroutines diff --git a/core/errors.nom b/core/errors.nom index 91f9b4f..c6551b5 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains basic error reporting code diff --git a/core/io.nom b/core/io.nom index 48db71f..55c5702 100644 --- a/core/io.nom +++ b/core/io.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains basic input/output code diff --git a/core/math.nom b/core/math.nom index 57088eb..5717482 100644 --- a/core/math.nom +++ b/core/math.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file defines some common math literals and functions 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" diff --git a/core/operators.nom b/core/operators.nom index 0712ada..995b561 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains definitions of operators like "+" and "and". diff --git a/core/scopes.nom b/core/scopes.nom index 3af59c5..19b9e49 100644 --- a/core/scopes.nom +++ b/core/scopes.nom @@ -1,3 +1,7 @@ +#!/usr/bin/env nomsu -V1 +# + This file contains definitions pertaining to variable scoping + use "core/metaprogramming.nom" use "core/operators.nom" use "core/collections.nom" diff --git a/core/text.nom b/core/text.nom index d09e6b5..514334b 100644 --- a/core/text.nom +++ b/core/text.nom @@ -1,3 +1,4 @@ +#!/usr/bin/env nomsu -V1 # This file contains some definitions of text escape sequences, including ANSI console color codes. -- cgit v1.2.3