This commit is contained in:
iko 2024-07-23 22:29:35 +03:00
parent 81ab9694a9
commit 9c4884174f
Signed by untrusted user: iko
GPG Key ID: 82C257048D1026F2
4 changed files with 48 additions and 0 deletions

View File

@ -45,6 +45,25 @@ apex
wss
parse-funcbody
==
::
%+ cook |= [=unop =expr] [%unop unop expr]
;~ plug
;~ pose
;~ sfix
;~ pose
(cold %minus (just '-'))
(cold %sig (just '~'))
(cold %hax (just '#'))
==
ws
==
;~ sfix
(cold %not (jest 'not'))
wss
==
==
%+ knee *expr |.(parse-expr)
==
==
:: Parse expressions separated by binary operators
::

View File

@ -34,6 +34,24 @@ print
%string (print-string +.expr)
%wildcard "..."
%functiondef (print-funcbody +.expr)
%unop
%- zing
:~
(print-unop +<.expr)
" "
(print-expr +>.expr)
==
==
:: unop
::
++ print-unop
|= =unop
^- tape
?- unop
%minus "-"
%not "not"
%hax "#"
%sig "~"
==
:: string
::

View File

@ -12,6 +12,7 @@
[%string string]
[%binop expr binop expr]
[%prefix-expr prefix-expr]
[%unop op=unop =expr]
[%num numeral]
[%table table]
[%true ~]
@ -26,6 +27,13 @@
[%keyed expr expr]
[%unkeyed expr]
==
+$ unop
$?
%minus
%not
%hax
%sig
==
+$ binop
$?
%add

View File

@ -107,3 +107,6 @@ local b = require('mod2')
function adder(x)
return function (y) return x + y end
end
x = -1 + 8