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:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user