diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-18 01:27:56 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-18 01:28:17 -0700 |
| commit | d5cfaa37be9e278c44a25ef448a071390597306e (patch) | |
| tree | 7fbe78b5153bb9c761c283533943ab80da3a1844 /lib/training_wheels.nom | |
| parent | c7c657d38f999901225b33482ef3a15994526feb (diff) | |
Upgrading to version 2.3 (main change: "=" instead of "<-" for
assignment)
Diffstat (limited to 'lib/training_wheels.nom')
| -rw-r--r-- | lib/training_wheels.nom | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/training_wheels.nom b/lib/training_wheels.nom index ea13ac0..4c0b166 100644 --- a/lib/training_wheels.nom +++ b/lib/training_wheels.nom @@ -1,11 +1,10 @@ -#!/usr/bin/env nomsu -V2.2.4.3 +#!/usr/bin/env nomsu -V2.3.4.3 # This file contains a set of definitions that bring some familiar language features from other languages into nomsu (e.g. "==" and "continue") use "core" - -parse [%a = %b] as (%a <- %b) +parse [%a == %b] as (%a = %b) parse [%a == %b] as (%a is %b) parse [%a ~= %b, %a != %b, %a <> %b] as (%a is not %b) parse [%a === %b] as ((%a 's id) is (%b 's id)) @@ -21,26 +20,26 @@ parse [%a || %b] as (%a or %b) parse [%a && %b] as (%a and %b) parse [continue] as (do next) parse [break] as (stop) -parse [let %thing = %value in %action] as (with [%thing <- %value] %action) +parse [let %thing = %value in %action] as (with [%thing = %value] %action) parse [print %] as (say %) parse [error!, panic!, fail!, abort!] as (barf!) parse [error %, panic %, fail %, abort %] as (barf %) parse [assert %condition %message] as (assume %condition or barf %message) parse [%cond ? %if_true %if_false] as (%if_true if %cond else %if_false) compile [function %args %body, lambda %args %body] to: - %lua <- (Lua value "(function(") + %lua = (Lua value "(function(") for %i = %arg in %args.value: if (%i > 1): to %lua write ", " to %lua write (%arg as lua expr) to %lua write ")\n " - %body <- (%body as lua) + %body = (%body as lua) lua> "\%body:convert_to_statements('return ');" for % in %args.value: lua> "\%body:remove_free_vars(\%);" to %lua write %body to %lua write "\nend)" return %lua -parse [function %name %args %body] as (%name <- (function %args %body)) +parse [function %name %args %body] as (%name = (function %args %body)) compile [call %fn %args] to (..) - Lua value "\(%fn as lua expr)(unpack(\(%args as lua expr)))" + Lua value "\(%fn as lua expr)(unpack(\(%args as lua expr)))"
\ No newline at end of file |
