(with_import "./fungll.kp"
(let (

    _ (println "The a parser")
    just_a_parser (parse (nterm 'A (altOp altStart (seqOp seqStart (term "a")))))
    _ (println "parse result for a " (just_a_parser "a"))
    _ (println "parse result for b " (just_a_parser "b"))
    _ (println "parse result for aa " (just_a_parser "aa"))
    _ (println "parse result for ba " (just_a_parser "ba"))
    _ (println "parse result for ab " (just_a_parser "ab"))

    _ (println "The aa parser")
    just_aa_parser (parse (nterm 'A (altOp altStart (seqOp seqStart (term "aa")))))
    _ (println "parse result for a " (just_aa_parser "a"))
    _ (println "parse result for b " (just_aa_parser "b"))
    _ (println "parse result for aa " (just_aa_parser "aa"))
    _ (println "parse result for ba " (just_aa_parser "ba"))
    _ (println "parse result for ab " (just_aa_parser "ab"))

    _ (println "The a.a parser")
    just_aa_parser (parse (nterm 'A (altOp altStart (seqOp (seqOp seqStart (term "a")) (term "a")))))
    _ (println "parse result for a " (just_aa_parser "a"))
    _ (println "parse result for b " (just_aa_parser "b"))
    _ (println "parse result for aa " (just_aa_parser "aa"))
    _ (println "parse result for ba " (just_aa_parser "ba"))
    _ (println "parse result for ab " (just_aa_parser "ab"))

    _ (println "The b|a.a parser")
    just_aa_parser (parse (nterm 'A (altOp (altOp altStart (seqOp seqStart (term "b"))) (seqOp (seqOp seqStart (term "a")) (term "a")))))
    _ (println "parse result for a " (just_aa_parser "a"))
    _ (println "parse result for b " (just_aa_parser "b"))
    _ (println "parse result for aa " (just_aa_parser "aa"))
    _ (println "parse result for ba " (just_aa_parser "ba"))
    _ (println "parse result for ab " (just_aa_parser "ab"))

    _ (println "The a|a,A parser")
    just_aa_parser (let-rec (
                        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"))
    _ (println "parse result for aa " (just_aa_parser "aa"))
    _ (println "parse result for ba " (just_aa_parser "ba"))
    _ (println "parse result for ab " (just_aa_parser "ab"))
    _ (println "parse result for a,a " (just_aa_parser "a,a"))
    _ (println "parse result for a,a,a " (just_aa_parser "a,a,a"))

) nil))
