All Projects → darius → parson

darius / parson

Licence: other
Yet another PEG parser combinator library and DSL

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to parson

pe
Fastest general-purpose parsing library for Python with a familiar API
Stars: ✭ 21 (-59.62%)
Mutual labels:  parsing, parsing-expression-grammar, peg, parsing-library
cppcombinator
parser combinator and AST generator in c++17
Stars: ✭ 20 (-61.54%)
Mutual labels:  parsing, parsing-expression-grammar, peg
pyrser
A PEG Parsing Tool
Stars: ✭ 32 (-38.46%)
Mutual labels:  parsing, parsing-expression-grammar, peg
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (-67.31%)
Mutual labels:  parsing, parsing-expression-grammar, peg
ohm-editor
An IDE for the Ohm language (JavaScript edition)
Stars: ✭ 78 (+50%)
Mutual labels:  parsing, peg
Ohm-S
A Squeak/Smalltalk implementation of the metaprogramming framework Ohm.
Stars: ✭ 18 (-65.38%)
Mutual labels:  parsing, parsing-expression-grammar
autumn
A Java parser combinator library written with an unmatched feature set.
Stars: ✭ 112 (+115.38%)
Mutual labels:  parsing, parsing-expression-grammar
Pom
PEG parser combinators using operator overloading without macros.
Stars: ✭ 310 (+496.15%)
Mutual labels:  parsing, peg
FAParser
JSON Parsing + Archiving & Unarchiving in User Defaults
Stars: ✭ 67 (+28.85%)
Mutual labels:  parsing, parsing-library
latex2unicode
Convert LaTeX markup to Unicode (in Scala and Java)
Stars: ✭ 28 (-46.15%)
Mutual labels:  parsing, peg
Cpp Peglib
A single file C++ header-only PEG (Parsing Expression Grammars) library
Stars: ✭ 435 (+736.54%)
Mutual labels:  parsing, peg
GreynirPackage
The Greynir NLP parser for Icelandic, packaged for PyPI
Stars: ✭ 49 (-5.77%)
Mutual labels:  parsing, parsing-library
3bmd
markdown processor in CL using esrap parser
Stars: ✭ 58 (+11.54%)
Mutual labels:  parsing, peg
DotGrok
Parse text with pattern. Inspired by grok filter.
Stars: ✭ 26 (-50%)
Mutual labels:  parsing, parsing-library
Lug
Parsing expression grammar (PEG) embedded domain specific language and parsing machine for C++17
Stars: ✭ 44 (-15.38%)
Mutual labels:  parsing, peg
kiuatan
A parser library for Pony.
Stars: ✭ 15 (-71.15%)
Mutual labels:  parsing-expression-grammar, peg
Nearley
📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
Stars: ✭ 3,089 (+5840.38%)
Mutual labels:  parsing, parsing-library
extract-emails
Extract emails from a given website
Stars: ✭ 58 (+11.54%)
Mutual labels:  parsing, parsing-library
Pest
The Elegant Parser
Stars: ✭ 2,783 (+5251.92%)
Mutual labels:  parsing, peg
Rust Peg
Parsing Expression Grammar (PEG) parser generator for Rust
Stars: ✭ 836 (+1507.69%)
Mutual labels:  parsing, peg

parson

Yet another PEG parser combinator library in Python. Selling points:

  • The optional concrete syntax for grammars incorporates semantic actions in a concise host-language-independent way. A Parson grammar won't tie you to Python.

  • Whole grammars can be analyzed and compiled, even if built at runtime using combinators. (Contrast with a monadic library, where this is uncomputable.)

  • Semantic actions take and return values in a kind of point-free style.

  • You can use the concrete syntax with about as little ceremony as re.match.

  • You can parse non-string sequences.

Anti-selling points:

  • This library's in fluid design still, undocumented, utterly untuned, etc. I'd like you to use it if you think you might give feedback on the design; otherwise, no promises.

  • Semantic actions work in a nontraditional way that may remind you of Forth and which I haven't yet tried to make play well in typed languages like Haskell. It's concise and just right for parsing, but maybe in the end it'll turn out too cute and make me rip it out if I want this to be used.

  • I don't intend to make grammars work in other host languages before the design settles. (I have done this a bit for the Peglet library, a more basic and settled expression of the same approach to actions: it has Python and JavaScript ports.)

I guess the most similar library out there is LPEG, and that's way way more polished.

Examples

For now, see all the eg_whatever.py files here. eg_calc.py, eg_misc.py, eg_wc.py, and eg_regex.py have the smallest ones. eg_trees.py shows parsing of tree structures, OMeta-style. Other examples include programming languages and other somewhat-bigger stuff.

Basic things still to explain:

  • grammar syntax
  • combinators
  • recursion with combinators
  • actions

Examples of where I've used it for more than examples:

  • IDEAL, a drawing language
  • Linogram, also a drawing language
  • Pythological, a MiniKanren with a vaguely Prologish frontend
  • tinyhiss -- Smalltalkish
  • Squee, an experimental language not much like any others
  • Toot, a tutorial on writing a bytecode compiler

Needs more work:

  • There's a way to make a grammar automatically skip whitespace and comments and such ('FNORD' rules), which probably should be done differently.

  • It should be made easy to use with a separate lexer, and I haven't tried this enough to say it's ready (it's probably not).

  • It should also be easy to write a 'real' compiler, where source-location info gets added to all the AST nodes or whatever representation you're building. This is doable but should be more automated.

After these design issues, this ought to be ported to a different-enough language to bring out issues of working nicely with multiple languages.

After that, I think it'd be time to tackle quality of implementation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].