-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support for Lark-style EBNF #4
Comments
I'll see what I can do. 👍 Rather than modify EBNF's grammar, though, it'll be better to add a dedicated grammar for LEBNF instead. Lark's format is well-defined and uses a non-conflicting file extension, whereas
It's actually TextMate's grammar format, adopted by Atom/GitHub, VSCode, and Sublime Text. Each have different requirements on file format: Atom uses CSON/JSON, VSCode and TextMate use XML property lists, and Sublime uses YAML. Regardless of their representation, all TextMate-compatible grammars are structurally similar, and the ones you'll encounter are often converted from a TextMate bundle (except mine… I proudly pen them all from scratch). Other than TextMate's grammar reference, the only other reliable source of info (that I know of) is this blog post. It covers several critical (but undocumented) details of writing a TMCG, and discusses the hacks necessary to work around TextMate's notorious lack of multiline pattern support. |
Righto, all done! This covers everything in both the docs and Lark's own grammar definition. Here's a preview: |
I've also submitted a PR to have Lark grammars supported/highlighted on GitHub. See github-linguist/linguist#5049. |
Lark is a parsing library for python. It's flavored EBNF files (
.lark
) needs syntax highlighting. The only difference between lark EBNF (which I'll refer to as LEBNF) and EBNF is that LEBNF's comments are js-style, without multi-line comment support, brackets denote optional groups, a?
and/or!
are operators that may appear before the definition of a rule orTERMINAL
, priority, denoted byTERMINAL.number
, is a thing, and it has%import
,%ignore
, and%declare
statements.Detailed grammar reference can be found here
Would you modify
EBNF.cson
, and turn it toLEBNF.cson
, please? I have no idea on how to write an atom grammar (I find it poorly documented on atom.io)The text was updated successfully, but these errors were encountered: