2018-11-11 15:50:46 -08:00
|
|
|
#!/usr/bin/env nomsu -V4.10.12.7
|
2018-05-15 18:55:55 -07:00
|
|
|
#
|
2018-01-11 18:51:21 -08:00
|
|
|
This file contains a set of definitions that bring some familiar language features
|
2018-07-30 19:11:12 -07:00
|
|
|
from other languages into nomsu (e.g. "||" and "continue")
|
2018-11-11 15:50:46 -08:00
|
|
|
|
|
|
|
(%a === %b) parses as ((%a's id) is (%b's id))
|
|
|
|
(%a !== %b) parses as ((%a's id) is not (%b's id))
|
2018-10-30 23:42:04 -07:00
|
|
|
[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)
|
2018-11-11 15:50:46 -08:00
|
|
|
(let %thing = %value in %action) parses as (with local {%thing: %value})
|
2018-10-30 23:42:04 -07:00
|
|
|
[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))
|