Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork298
Paul McGuire edited this pageAug 21, 2021 ·3 revisions
- Don't clutter up the parser grammar with whitespace, just handle it! (likewise for comments)
- Class names are easier to read and understand than specialized typography
- Use operators to implement an embedded parsing DSL:
+for And|for MatchFirst^for Or~for NotAny&for Each (like And, but accepting out of order)-for And with no backtracking<<and<<=for Forward...for SkipTo[...]for ZeroOrMore
- Simple grammars can return lists; complex grammars need named results
- Parsers can do more than just tokenize
- Grammars should be:
- easy (and quick) to write
- easy to read
- easy to update
- No separate code-generation step (like lex/yacc)
- No forced naming conventions (like PLY)
- Stay Pure Python
- Liberally licensed (MIT license – free for commercial use)