Parse EBNF: Difference between revisions

Content added Content deleted
(Added PicoLisp)
(Want to {{improve}} both examples.)
Line 12: Line 12:


=={{header|PicoLisp}}==
=={{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)
<lang PicoLisp>(de parse (Str)
(let *L (str Str "")
(let *L (str Str "")
Line 52: Line 54:


=={{header|Tcl}}==
=={{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.
Demonstration lexer and parser. Note that this parser supports parenthesized expressions, making the grammar recursive.
<lang tcl>package require Tcl 8.6
<lang tcl>package require Tcl 8.6