-
Notifications
You must be signed in to change notification settings - Fork 165
Backend ideas
Ben Samuel edited this page Jul 6, 2020
·
12 revisions
It doesn't seem that there is a canonical tool such as lex/yacc in python. A list of parsing tools is available on the python wiki.
We could replace those backend by a pandoc backend. This has a few advantages:
- it can generate more formats
- pandoc-types provide a nice API to create documents programatically
- we don't have to maintain a latex backend and a plain text backend separately
- Jison is a port of flex/yacc in javascript so it might not be so hard to derive a javascript backend from the C one
- pegjs
- Canopy, which can also generate python, java and ruby frontends.
- BNF notation
- EBNF
- ABNF
Go comes with a port of yacc which should make adding this fairly easy. There is no flex/lex equivalent though.
The Lemon program is an LALR(1) parser generator. It takes a context free grammar and converts it into a subroutine that will parse a file using that grammar. Wikipedia
The Tree-sitter project generates a C library for incremental parsing that has bindings in Rust, JavaScript via Wasm, Node.js, Python, Ruby and Haskell.
Use case: Implementing IDE plugins and other build tools that watch files and react incrementally to changes.