nomsu/lib/training_wheels.nom

28 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env nomsu -V4.10.12.7
2018-05-15 18:55:55 -07:00
#
This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "||" and "continue")
(%a === %b) parses as ((%a's id) is (%b's id))
(%a !== %b) parses as ((%a's id) is not (%b's id))
[function %names %body, def %names %body] all parse as (..)
externally %names means %body
(switch %branch_value %body) parses as (if %branch_value is %body)
[None, Null] all parse as (nil)
[True, true] all parse as (yes)
[False, false] all parse as (no)
(pass) parses as (do nothing)
(%a || %b) parses as (%a or %b)
(%a && %b) parses as (%a and %b)
(continue) parses as (do next)
(break) parses as (stop)
(let %thing = %value in %action) parses as (with local {%thing: %value})
[print %, println %] all parse as (say %)
[error!, panic!, fail!, abort!] all parse as (barf!)
[error %, panic %, fail %, abort %] all parse as (barf %)
(assert %condition) parses as (assume %condition)
(assert %condition %message) parses as (assume %condition or barf %message)
(%cond ? %if_true %if_false) parses as (%if_true if %cond else %if_false)
(lambda %args %body) parses as (%args -> %body)
(function %name %args %body) parses as (%name = (%args -> %body))