From f1a2c936de700ddf1c7ccb650be9598db40c13d4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 1 Nov 2017 16:49:11 -0700 Subject: Fixed some codegen stuff, optimized "say" for the common case of string literals. --- lib/utils2.nom | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/utils2.nom (limited to 'lib/utils2.nom') diff --git a/lib/utils2.nom b/lib/utils2.nom new file mode 100644 index 0000000..2562471 --- /dev/null +++ b/lib/utils2.nom @@ -0,0 +1,10 @@ +require "lib/metaprogramming.nom" +require "lib/utils.nom" +require "lib/control_flow.nom" +require "lib/operators.nom" + +compile [say %str] to: + if ((%str's "type") == "String"): + "nomsu:writeln(\(%str as lua))" + ..else: + "nomsu:writeln(nomsu:stringify(\(%str as lua)))" -- cgit v1.2.3