-
Notifications
You must be signed in to change notification settings - Fork 55
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
Why semicolon #11
Comments
There are two ways to define grammars in Arpeggio. A canonical is based on Python expressions and statements. The other is a textual PEG syntax and it is implemented using the Arpeggio itself (you can find the grammar of PEG language in the arpeggio.peg module). This implementation is based on PEG language and it requires that each rule terminates with ";" (see the rule function in the The PEG grammar definition is parsed using Arpeggio instantiated with the grammar from Best regards, |
I'm not interested in python based functions as they will make it very specific to this lib. Yes I agree for portability it should contain but it should be optional in lib itself. I mean if someone write it internally ignore that and make lib grammar reading easy. <- can become = Clean looking ( Requested version) I guess I may be wrong but I found this style much everywhere so yes you can use it. Or provide some internal ways to support both. If it sounds interesting. I want to parse PHP and similar web languages I'm not sure textX will be suited in that case or not. I don't want to parse full things only desired portion from PHP files and similar other langs. I'm not designing any lang just parsing few existing web langs. Thanks, |
I agree that this is cleaner looking. The current syntax is based on the original papers on PEG. PEG language in The syntax is very easy to alter. Make a copy of module Let me now if this works for you. Best, |
Cool . Thank you. Let me try it. 😄 |
I followed your instruction and created a cleanpeg module with above mention changes. Unfortunately it didn't work Used grammer // Grammar is defined using textual specification based on PEG language. Please let me know if I'm doing anything wrong. Thanks, |
Don't have time to look more thoroughly but I think that the grammar is ambiguous now. Regards, |
Actually, the PEG grammar can't be ambiguous and in this case the lhs will always be matched as a part of previous rule so the "=" will never be matched. Still, the best is to leave rule termination (";") or you could alter the grammar to use syntax predicates (e.g. Not) to check if the next part of the rule is not followed by the "=" and to match is only if it is not. This will ensure that lhs of the following rule is never matched by the previous rule. |
ok with ; and <- it works perfectly. It looks we need to change little more about handling ending of rules. I've a idea internally you can check for /n if that is possible instead of ; Thanks, |
Just added change on branch cleanpeg. Check this commit. Regards, |
Great 👍 😄 Let me try it |
Work superbly no error reported this time. Thank you. |
Python users see things clean and never use ; to end statements. This is obvious for many langs but it looks extra in python.
While using grammar I found it mandatory to put semicolon (;) at end of each line which is looks unnecessary to me.
I hope you got my point :) What is your opinion?
Thanks,
Yash , KineticWing IDE
The text was updated successfully, but these errors were encountered: