Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TatSu also accept PEG syntax #126

Open
apalala opened this issue May 19, 2019 · 1 comment
Open

Make TatSu also accept PEG syntax #126

apalala opened this issue May 19, 2019 · 1 comment

Comments

@apalala
Copy link
Collaborator

apalala commented May 19, 2019

The TatSu grammar syntax is the result of the experience with parsing several major programming languages. Common constructs have shortcuts that help in building ASTs.

For people coming from other parser generators or wanting to experiment with different ones, it would be good if their grammar in standard PEG syntax was understood by TatSu.

Another syntax that TatSu could accept is standard EBNF.

@Victorious3
Copy link
Collaborator

I've come to like Tatsu's syntax. I think its just close enough to EBNF, the only real difference I see is that it allows having spaces in non terminals, which sounds like an awful idea considering python identifiers don't. To quote Wikipedia:

The International Organization for Standardization adopted an EBNF standard (ISO/IEC 14977) in 1996. However, according to Zaytsev this standard "only ended up adding yet another three dialects to the chaos" and, after noting its lack of success, also notes that the ISO EBNF is not even used in all ISO standards. Wheeler argues against using the ISO standard when using an EBNF, and recommends considering alternative EBNF notations such as the one from the W3C Extensible Markup Language (XML) 1.0 (Fifth Edition).

It does look a lot like Wirth's EBNF: https://en.wikipedia.org/wiki/Wirth_syntax_notation
... except for the semicolon. Buggers.

As for PEG, is there even a standard around for that? There's / for ordered choice but so far I've seen every parser generator make some additions (https://github.com/PhilippeSigaud/Pegged/wiki/Extended-PEG-Syntax for reference) and the rest looks close enough to Tatsu again.

In short, I don't think it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants