Parse EBNF: Difference between revisions
Content added Content deleted
(Added PicoLisp) |
(Want to {{improve}} both examples.) |
||
Line 12:
=={{header|PicoLisp}}==
{{improve|PicoLisp|This is not an EBNF parser. It never uses EBNF. It is a calculator parser, but there is already a calculator parser at [[Arithmetic evaluation#PicoLisp]]. One should adjust this solution to parse the EBNF language, not the calculator language.}}
<lang PicoLisp>(de parse (Str)
(let *L (str Str "")
Line 52 ⟶ 54:
=={{header|Tcl}}==
{{improve|PicoLisp|This is not an EBNF parser. It never uses EBNF. It is a calculator parser, but there is already a calculator parser at [[Arithmetic evaluation#Tcl]]. One should adjust this solution to parse the EBNF language, not the calculator language.}}
Demonstration lexer and parser. Note that this parser supports parenthesized expressions, making the grammar recursive.
<lang tcl>package require Tcl 8.6
|