(Macro\\c)
Jump to navigation
Jump to search
- This is still a work in progress. It may be changed in the future.
(macro\\c) is a language where everything is a macro.
Syntax
(macroname\argument1\arg2\...\argx\code)
defines a macro, code part can contain balanced parens.
When macronman
is encounterd, code is executed, [arg]
access an arfunemt.
There's a stack which stores strings. when a macro with args are executed, appropriate numbers of args are popped, LAST ARGUMENT IS POPPED FIRST.
anything that's not a macro name or$...$
push them ob the stack. (12$12$
pushes 1, 2, 12 ibnto the stack)
e.g.ab(1\a\b\[a](2\[b]))122
does push a, then define a macro called 2 which pushes b, then push b twice.
:
output the TOS, ;
inputs a character and push.
Examples
duplicate the TOS
(d\x\$[x]$$[x]$)
eval the TOS
(e\x\[x])
Hello, World!
!dlroW ,olleH:::::::::::::
cat
(c\;:c)c
Truth-machine
(e\x\[x])(0\$0$:)(1\$1$:1);e