Steven Haryanto poses a problem in this blog post
<http://blogs.perl.org/users/steven_haryanto/2014/04/detecting-jsonyamlperlcsvtsvltsv.html>
of disambiguating JSON/YAML/Perl/CSV/TSV/LTSV. A Marpa solution would
be an interesting approach. A Marpa solution might no be quite as fast
as some others but it would be more robust in the sense that you could
add new languages/formats or change the way you look for existing ones.
Also Marpa would allow for the very real case that a string actually
matches more than one language/format. (A lot more strings are valid
Perl than one might at first suspect.)
The method would be something like
string ::= JSON | YAML | Perl | CSV | TSV | LTSV
JSON ::= <stuff>
YAML ::= <other stuff>
Perl ::- <a whole bunch of stuff>
etc, etc.
Marpa will ambiguously parse them all. If you keep the symbol sets
disjoint, or take similar precautions, the parse will be in linear time
as long as all the languages/formats are parseable in linear time.
-- jeffrey
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.