Add tests

This commit is contained in:
Yiyun Liu 2025-05-27 23:18:57 -04:00
parent 4d186e6b2b
commit 30133f80e7
8 changed files with 61 additions and 4 deletions

View file

@ -40,7 +40,7 @@
[";" (token-SEMICOLON)]
[(+ numeric) (token-NUM (string->number lexeme))]
[(: alphabetic (* (or alphabetic numeric #\_))) (token-VAR (string->symbol lexeme))]
[blank (core/lexer input-port)]))
[whitespace (core/lexer input-port)]))
(define core/parser
(parser
@ -86,7 +86,7 @@
[vars [() (list)]
[(vars VAR) (cons $2 $1)]]
[vars1 [(vars VAR) (cons $2 $1)]]
[alt [(LBRAK NUM RBRAK vars ARROW expr) (list 'branch $2 (reverse $4) $6)]]
[alt [(LBRAK NUM RBRAK vars ARROW expr) (list $2 (reverse $4) $6)]]
[alts [(alt) (list $1)]
[(alts SEMICOLON alt) (cons $3 $1)]]]))