Bugfix & added an extra lambda wrapping around term/nterm so that their value can be made recursive with let-rec, and with that the parser works! On the other hand, it takes 38 seconds to parse 'a,a,a' with the grammer A='a'|'a' ',' A .... so that could be a lot better.

This commit is contained in:
Nathan Braswell
2021-08-05 00:39:56 -04:00
parent c8c876e1bc
commit ae82af6636
2 changed files with 20 additions and 9 deletions

View File

@@ -35,7 +35,7 @@
_ (println "The a|a,A parser")
just_aa_parser (let-rec (
As (nterm 'A (altOp (altOp altStart (seqOp seqStart (term "a"))) (seqOp (seqOp seqStart (term ",")) As)))
As (nterm 'A (altOp (altOp altStart (seqOp seqStart (term "a"))) (seqOp (seqOp (seqOp seqStart (term "a")) (term ",")) As)))
) (parse As))
_ (println "parse result for a " (just_aa_parser "a"))
_ (println "parse result for b " (just_aa_parser "b"))