Parse EBNF: Difference between revisions
m
→{{header|Perl 6}}: minus meta-op
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: minus meta-op) |
|||
Line 1,215:
</pre>
=={{header|Perl 6}}==
{{works with|Rakudo|
This parses the EBNF rule set using a perl 6 grammar, then if it parses as valid EBNF, constructs a grammar and parses the test strings with that. EBNF rule sets that are naively syntactically correct but missing rules will parse as valid but will give a runtime failure warning about missing methods.
Line 1,344:
$fh.say( q|say "\nValid syntax.\n\nTesting:\n";| );
$fh.say( q|CATCH { default { say " - $_" } };| );
my $len =
for $test<teststrings>.flat -> $s {
$fh.say( qq|printf "%{$len}s", '{$s}';| ~
|