Nomsu
Nomsu (named after Nomic, and its creator, Peter Suber) is a programming language designed to be used for playing games of Nomic, or engaging in other similar activities revolving around natural language rule-making and self modification. More information is available at Nomsu's homepage.
Dependencies
Nomsu's only dependencies are Lua 5.2+ (or Luajit 2.0+, compiled with XCFLAGS=-DLUAJIT_ENABLE_LUA52COMPAT for Lua 5.2 compatibility) and LPEG (luarocks install lpeg). Nomsu's compiler was written in Moonscript, but all of the .moon files have been compiled into lua for convenience, so Moonscript is not a dependency. Optionally, if luafilesystem (Lua version or LuaJIT version) is installed, it will be used. Otherwise Nomsu will fall back to using system commands (find and ls), which is slower and a bit less safe. Nomsu has been tested on Mac and Linux, but not Windows.
Usage
- To run Nomsu interactively (a REPL), simply run
lua nomsu.lua(orluajit nomsu.lua). - To run a .nom file with Nomsu code, run
lua nomsu.lua your_file.nom. - The full usage options are avilable via
lua nomsu.lua --help.
Examples
There's a more complete set of example code in examples/how_do_i.nom, but roughly, Nomsu looks like:
1 say "Hello"3 $my_nums = [5, 23, 42]4 for $num in $my_nums:5 say "\$num is one of my nums"7 (sing $n bottles of beer) means:8 for $i in $n to 1 by -1:9 say ("10 \$i bottle\("s" if ($i > 1) else "") of beer on the wall,11 \$i bottle\("s" if ($i > 1) else "") of beer!12 Take one down, pass it around...13 ")14 say "No bottles of beer on the wall."16 sing 99 bottles of beer