cleaning up and trying to refine grammar

This commit is contained in:
Matt Nish-Lapidus 2024-05-22 10:59:45 -04:00
parent de5be03c88
commit a3bf799e87
5 changed files with 3 additions and 69 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,2 +0,0 @@
build:
npx lezer-generator ludus.grammar -o ludus.js

View File

@ -2,7 +2,7 @@
@top Script { (newline | terminator)* line+ } @top Script { (newline | terminator)* line+ }
@skip { space | comment } @skip { space | Comment }
line { (expression | toplevel) !line_end (newline | terminator)+ } line { (expression | toplevel) !line_end (newline | terminator)+ }
@ -259,7 +259,7 @@ Nil { silent<"nil"> }
@tokens { @tokens {
Word { $[a-z] $[a-zA-Z_\-?/!]* } Word { $[a-z] $[a-zA-Z_\-?/!]* }
space { $[ \t\r]+ } space { $[ \t\r]+ }
comment { "&" ![\n]* } Comment { "&" ![\n]* }
String { '"' (!["\\] | "\\" _)* '"' } String { '"' (!["\\] | "\\" _)* '"' }
int { $[1-9]$[0-9]* | "0" } int { $[1-9]$[0-9]* | "0" }
float { ("0" | int ) "." $[0-9]+} float { ("0" | int ) "." $[0-9]+}

File diff suppressed because one or more lines are too long

View File

@ -1,47 +0,0 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
Script = 1,
Boolean = 2,
Word = 3,
Nil = 6,
String = 7,
Number = 8,
Keyword = 9,
Tuple = 10,
List = 11,
Splat = 12,
Set = 13,
Dict = 14,
Synthetic = 15,
Args = 16,
Placeholder = 17,
Fn_Lambda = 18,
Fn_Clause = 19,
Tuple_Pattern = 20,
Pattern = 21,
List_Pattern = 22,
Splattern = 23,
Ignored = 24,
Dict_Pattern = 25,
Assoc_Pattern = 26,
Recur = 27,
Block = 28,
If = 29,
If_Let = 30,
Match = 31,
Match_Clause = 32,
Else = 33,
When = 34,
When_Clause = 35,
Do = 36,
Loop = 37,
Fn_Clauses = 38,
Repeat = 39,
Let = 40,
Ref = 41,
Fn_Named = 42,
Fn_Compound = 43,
Import = 44,
Use = 45,
Ns = 46,
Test = 47