Parse EBNF: Difference between revisions

No change in size ,  5 years ago
m
m (→‎{{header|Perl 6}}: minus meta-op)
Line 1,215:
</pre>
=={{header|Perl 6}}==
{{works with|Rakudo|20132019.0903.1}}
 
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 = [max] $test<teststrings>.flat>>.chars;
for $test<teststrings>.flat -> $s {
$fh.say( qq|printf "%{$len}s", '{$s}';| ~
2,392

edits