Parse EBNF: Difference between revisions
Content added Content deleted
m (→{{header|PicoLisp}}: Flag problem) |
(Parse EBNF from string format) |
||
Line 12: | Line 12: | ||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
<lang PicoLisp>(de EBNF |
|||
{{improve|PicoLisp|The input description should be EBNF, not a parsed form of it.}} |
|||
"expr : term ( ( PLUS | MINUS ) term )* ;" |
|||
"term : factor ( ( MULT | DIV ) factor )* ;" |
|||
"factor : NUMBER ;" ) |
|||
(for E EBNF |
|||
(use (@S @E) |
|||
(unless (and (match '(@S : @E ;) (str E)) (not (cdr @S))) |
|||
(quit "Invalid EBNF" E) ) |
|||
(put (car @S) 'ebnf @E) ) )</lang> |
|||
<lang PicoLisp>(de matchEbnf (Pat) |
<lang PicoLisp>(de matchEbnf (Pat) |
||
(cond |
(cond |