simplify lexical grammar

this is a core language after all
This commit is contained in:
rhiannon morris 2022-05-07 21:26:16 +02:00
parent 1c8b2b205b
commit 809a0fc859
2 changed files with 31 additions and 75 deletions

View file

@ -84,17 +84,16 @@ tests = "lexer" :- [
],
"punctuation" :- [
acceptsWith' "({[:,::]})"
acceptsWith' "({[:,]})"
[P LParen, P LBrace, P LSquare,
P Colon, P Comma, P DblColon,
P Colon, P Comma,
P RSquare, P RBrace, P RParen],
acceptsWith' " ( { [ : , :: ] } ) "
acceptsWith' " ( { [ : , ] } ) "
[P LParen, P LBrace, P LSquare,
P Colon, P Comma, P DblColon,
P Colon, P Comma,
P RSquare, P RBrace, P RParen],
acceptsWith' "-> → => ⇒ ** × << ⊲ ∷"
[P Arrow, P Arrow, P DblArrow, P DblArrow,
P Times, P Times, P Triangle, P Triangle, P DblColon],
acceptsWith' "→ ⇒ × ⊲ ∷"
[P Arrow, P DblArrow, P Times, P Triangle, P DblColon],
acceptsWith' "_" [P Wild]
],
@ -119,14 +118,12 @@ tests = "lexer" :- [
],
"keywords" :- [
acceptsWith' "fun" [K Fun],
acceptsWith' "λ" [K Fun],
acceptsWith' "λ" [K Lam],
acceptsWith' "let" [K Let],
acceptsWith' "in" [K In],
acceptsWith' "case" [K Case],
acceptsWith' "of" [K Of],
acceptsWith' "ω" [K Omega],
acceptsWith' "#" [K Omega],
acceptsWith' "funk" [Name "funk"]
],
@ -134,21 +131,6 @@ tests = "lexer" :- [
acceptsWith' "0" [N Zero],
acceptsWith' "1" [N One],
acceptsWith' "2" [N $ Other 2],
acceptsWith' "69" [N $ Other 69],
acceptsWith' "1_000" [N $ Other 1000],
acceptsWith' "0o0" [N Zero],
acceptsWith' "0o105" [N $ Other 69],
acceptsWith' "0O0" [N Zero],
acceptsWith' "0O105" [N $ Other 69],
acceptsWith' "0x0" [N Zero],
acceptsWith' "0x45" [N $ Other 69],
acceptsWith' "0xabc" [N $ Other 2748],
acceptsWith' "0xABC" [N $ Other 2748],
acceptsWith' "0xA_BC" [N $ Other 2748],
acceptsWith' "0X0" [N Zero],
acceptsWith' "0X45" [N $ Other 69],
acceptsWith' "0XABC" [N $ Other 2748],
rejects' "1_",
rejects' "1__000"
acceptsWith' "69" [N $ Other 69]
]
]