# Which parser generator are you using (if any)?

**URL:** https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233
**Category:** Parsing
**Created:** [February 12, 2020, 11:58am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233 "2020-02-12T11:58:49Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![cristian.vasile](https://d.strumenta.community/letter_avatar_proxy/v4/letter/c/958977/32.png) [@cristian.vasile](https://d.strumenta.community/u/cristian.vasile)
#### Post date: [February 18, 2020, 2:46am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/41 "2020-02-18T02:46:08Z")

</div>

Indeed, here is an example of making [Julia](https://julialang.org/) a procedural language for PostgreSQL.

[Creating a PostgreSQL procedural language – Part 1 – Setup](https://www.2ndquadrant.com/en/blog/creating-a-postgresql-procedural-language-part-1-setup/)  
[Creating a PostgreSQL procedural language – Part 2 – Embedding Julia](https://www.2ndquadrant.com/en/blog/creating-a-postgresql-procedural-language-part-2-embedding-julia/)

---

<div class="post-metadata">

### Author: ![cristian.vasile](https://d.strumenta.community/letter_avatar_proxy/v4/letter/c/958977/32.png) [@cristian.vasile](https://d.strumenta.community/u/cristian.vasile)
#### Post date: [February 18, 2020, 3:10am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/42 "2020-02-18T03:10:07Z")

</div>

I forgot one 🙂

Verifying concurrent programs for [Heisenbugs](https://en.wikipedia.org/wiki/Heisenbug) using [Leslie Lamport’s](http://www.lamport.org/) [TLA+](http://lamport.azurewebsites.net/tla/tla.html) machinery  
The idea is to take C/GO/D/Rust/Kotlin/etc source code and create automatically TLA+ specifications.  
I found one paper on this subject: Specifying and Verifying Concurrent C  
Programs with TLA+ [https://cedric.cnam.fr/fichiers/art\_3439.pdf](https://cedric.cnam.fr/fichiers/art_3439.pdf)  
Quote:  
“We define a set of translation rules and implement it in a tool (C2TLA+) that automatically translates C code into a TLA+ specification.”

---

<div class="post-metadata">

### Author: ![iandrich](https://d.strumenta.community/user_avatar/d.strumenta.community/iandrich/32/101_2.png) [@iandrich](https://d.strumenta.community/u/iandrich)
#### Post date: [February 18, 2020, 4:18am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/43 "2020-02-18T04:18:43Z")

</div>

Thats amazing. I’ve never heard of anyone attempting C to TLA+ spec before.

---

<div class="post-metadata">

### Author: ![ftomassetti](https://d.strumenta.community/user_avatar/d.strumenta.community/ftomassetti/32/8_2.png) [@ftomassetti](https://d.strumenta.community/u/ftomassetti)
#### Post date: [February 18, 2020, 7:09am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/44 "2020-02-18T07:09:38Z")

</div>

wow @cristian.vasile you are a mine of resources 😃

---

<div class="post-metadata">

### Author: ![cristian.vasile](https://d.strumenta.community/letter_avatar_proxy/v4/letter/c/958977/32.png) [@cristian.vasile](https://d.strumenta.community/u/cristian.vasile)
#### Post date: [February 18, 2020, 4:26pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/45 "2020-02-18T16:26:53Z")

</div>

Mr. Lamport himself was a little bit puzzled 🕶

---

<div class="post-metadata">

### Author: ![cristian.vasile](https://d.strumenta.community/letter_avatar_proxy/v4/letter/c/958977/32.png) [@cristian.vasile](https://d.strumenta.community/u/cristian.vasile)
#### Post date: [February 18, 2020, 5:50pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/46 "2020-02-18T17:50:08Z")

</div>

> [@anon67755252](#):
>
> Yes, I think the generated parser could have a built-in random symbol creator which  
> selects the next valid symbol from the valid symbols of the current state.

Paul,

I am sure that you did perform a strong testing processes against [LRSTAR](http://lrstar.tech/), however using this trick you can create a virtuous circle:  
C EBNF grammar → random source code gen → (100,000 C files) → LRSTAR and see if all random valid combinations are handled properly by LRSTAR.

---

<div class="post-metadata">

### Author: ![hexagonaal](https://d.strumenta.community/user_avatar/d.strumenta.community/hexagonaal/32/21_2.png) [@hexagonaal](https://d.strumenta.community/u/hexagonaal)
#### Post date: [February 20, 2020, 10:23am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/47 "2020-02-20T10:23:21Z")

</div>

For [JavaParser](https://github.com/javaparser) we’re using JavaCC. While it is a capable parser generator, the choice was simply made because the project was already using it when we adopted it. We really want to get rid of it now. The grammar is hard to read with all the included code snippets and all the added hacks and tricks to keep everything working, and while there seem to be a few people working on a new version, it is all very secretive and slow.

Because it is so odd to me that we can use BNF to specify a language, but nothing out there can handle all of the languages it can express, I tried to get into GLR for a while, but didn’t really find a well-documented, easy to get started with project out there.

Lately I’ve been experimenting with a simple language built from scratch and picked ANTLR for that, and it was almost disappointing how quickly the project moved past the lexing/parsing phase 😃 The clear writing from Terence Parr in his books is also a big help. This made me consider getting rid of JavaCC in JavaParser and moving to ANTLR since it would solve several long standing issues.

---

<div class="post-metadata">

### Author: ![ftomassetti](https://d.strumenta.community/user_avatar/d.strumenta.community/ftomassetti/32/8_2.png) [@ftomassetti](https://d.strumenta.community/u/ftomassetti)
#### Post date: [February 20, 2020, 6:01pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/48 "2020-02-20T18:01:13Z")

</div>

Yes, I would just add that JavaCC requires no runtime and this is a (small) benefit.  
The code of JavaCC is incredibly bad and unmaintained. The team behind it is very unresponsive to all sorts of help.  
So, I would strongly discourage anyone from using JavaCC. I am aware of two forks of it and I would consider them instead.  
That said I love ANTLR! I am using it for all sorts of things and it never disappointed me.  
Yet switching parser generator could prove… tricky

---

<div class="post-metadata">

### Author: ![cristian.vasile](https://d.strumenta.community/letter_avatar_proxy/v4/letter/c/958977/32.png) [@cristian.vasile](https://d.strumenta.community/u/cristian.vasile)
#### Post date: [February 20, 2020, 6:53pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/49 "2020-02-20T18:53:49Z")

</div>

Why you do not give LRSTAR a chance?

---

<div class="post-metadata">

### Author: ![anon67755252](https://d.strumenta.community/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@anon67755252](https://d.strumenta.community/u/anon67755252)
#### Post date: [February 20, 2020, 10:14pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/50 "2020-02-20T22:14:55Z")

</div>

Because LRSTAR is not well known and not Java based. C++ is considered  
problematic and Java is considered safe. And once you find something that  
works, you don’t want go through the painful process of switching to another.  
The author of LRSTAR does not have a PhD and all the charisma of Dr. Parr.  
However, LRSTAR has been generating parsers for companies since 1987  
and some people prefer it to ANTLR. BTW, the download contains complete  
source code, in case you want to compile for Linux, OS X, or Unix:  
[https://sourceforge.net/projects/lrstar/](https://sourceforge.net/projects/lrstar/)

---

<div class="post-metadata">

### Author: ![alebencz](https://d.strumenta.community/user_avatar/d.strumenta.community/alebencz/32/151_2.png) [@alebencz](https://d.strumenta.community/u/alebencz)
#### Post date: [February 21, 2020, 12:29pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/51 "2020-02-21T12:29:07Z")

</div>

Hi!  
Of all the compilers I implemented, virtually all of them I implemented the parser manually … using the recursive descending pattern.  
With regard to LALR, my friend Alex, implemented his own parser generator for his language, [https://github.com/ELENA-LANG/elena-lang](https://github.com/ELENA-LANG/elena-lang)

The “sg” program reads the file containing the language syntax, [https://github.com/ELENA-LANG/elena-lang/blob/master/dat/sg/syntax.txt](https://github.com/ELENA-LANG/elena-lang/blob/master/dat/sg/syntax.txt) , and generates a file with all the rules to perform the analysis.  
In the source code of the compiler, he manually implemented the DFA table, [https://github.com/ELENA-LANG/elena-lang/blob/b50b97a81b7a32328ac255391b26c259702e8a37/elenasrc2/elc/source.cpp](https://github.com/ELENA-LANG/elena-lang/blob/b50b97a81b7a32328ac255391b26c259702e8a37/elenasrc2/elc/source.cpp)

---

<div class="post-metadata">

### Author: ![igor.dejanovic](https://d.strumenta.community/user_avatar/d.strumenta.community/igor.dejanovic/32/43_2.png) [@igor.dejanovic](https://d.strumenta.community/u/igor.dejanovic)
#### Post date: [February 21, 2020, 6:42pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/52 "2020-02-21T18:42:47Z")

</div>

For DSL I use [textX](http://textx.github.io/textX/stable/) as it does all the heavy-lifting for me, and even a nice [VS Code integration](https://github.com/textX/textX-LS/tree/master/client) is in the development.

For more expression-like languages and general parsing where explicit handling of ambiguity is needed I use [parglare](http://www.igordejanovic.net/parglare/stable/) which is LR/GLR parser.

They are all Python libs and thus not very fast but so far they served me well. What is important to me and what I strive for, they have good documentation, test coverage, and very nice error reporting capabilities.

---

<div class="post-metadata">

### Author: ![anon67755252](https://d.strumenta.community/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@anon67755252](https://d.strumenta.community/u/anon67755252)
#### Post date: [February 24, 2020, 7:46am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/53 "2020-02-24T07:46:43Z")

</div>

**LRSTAR is Open Source now and BSD license.**  
Complete source-code is included, which compiles with GCC.  
The latest version is here:  
[https://sourceforge.net/projects/lrstar/](https://sourceforge.net/projects/lrstar/)

Actually, it reads a DSL for defining DSLs. But you knew that. All parser generators  
read a DSL of their own design. A BNF grammar is a kind of DSL, right?

---

<div class="post-metadata">

### Author: ![igor.dejanovic](https://d.strumenta.community/user_avatar/d.strumenta.community/igor.dejanovic/32/43_2.png) [@igor.dejanovic](https://d.strumenta.community/u/igor.dejanovic)
#### Post date: [February 24, 2020, 12:55pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/54 "2020-02-24T12:55:08Z")

</div>

Hi Paul. Thanks for the LRSTAR project.

I would like to suggest putting the LRSTAR project in a git repo on GitHub or some other git hosting service in an unzipped form. Just the source code and accompanying materials. It requires some work and learning if you haven’t done it before but it will greatly increase visibility of the project and possibility of contributions.

---

<div class="post-metadata">

### Author: ![anon67755252](https://d.strumenta.community/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@anon67755252](https://d.strumenta.community/u/anon67755252)
#### Post date: [February 24, 2020, 6:19pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/55 "2020-02-24T18:19:50Z")

</div>

That was done a few years ago by one of my users. It did not work out very well.  
ANTLR and many other parser generators have captured the minds of people.  
It seems like another parser generator is not wanted. Even in this group, everyone  
already has his own favorite tool. I’m surprised that people don’t want to take a look  
at LRstar. Well, it’s available at Source Forge. Just download and unzip. Most people  
have email, but very very few contact me. It needs to be taught in universities, but  
they are still teaching Yacc. OMG.

---

<div class="post-metadata">

### Author: ![thyagaraju](https://d.strumenta.community/user_avatar/d.strumenta.community/thyagaraju/32/177_2.png) [@thyagaraju](https://d.strumenta.community/u/thyagaraju)
#### Post date: [March 2, 2020, 11:54am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/56 "2020-03-02T11:54:57Z")

</div>

I’m exploring Antlr 4

---

<div class="post-metadata">

### Author: ![thad](https://d.strumenta.community/user_avatar/d.strumenta.community/thad/32/240_2.png) [@thad](https://d.strumenta.community/u/thad)
#### Post date: [March 25, 2020, 3:19pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/57 "2020-03-25T15:19:07Z")

</div>

I started using Irony initially and have recently begun using ANTLR because of frustrations with a language I was implementing. I primarily do all my work in C# so I was very happy when I found out that ANTLR can target C# now. I am still learning daily.

---

<div class="post-metadata">

### Author: ![thyagaraju](https://d.strumenta.community/user_avatar/d.strumenta.community/thyagaraju/32/177_2.png) [@thyagaraju](https://d.strumenta.community/u/thyagaraju)
#### Post date: [April 2, 2020, 2:43pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/58 "2020-04-02T14:43:18Z")

</div>

C# version is really cool, I did configure and using it with Visual Studio 2019, just started playing with listeners and visitors.

---

<div class="post-metadata">

### Author: ![rafael](https://d.strumenta.community/user_avatar/d.strumenta.community/rafael/32/236_2.png) [@rafael](https://d.strumenta.community/u/rafael)
#### Post date: [April 3, 2020, 1:42am UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/59 "2020-04-03T01:42:30Z")

</div>

I have used Antlr and JavaCC in the last couple of years, plus Xtext.

But I suspect no one else here is using my choice for the TextUML Toolkit since 2005:

[http://sablecc.org/](http://sablecc.org/)

I still use the same version from 2005. There was another version afterwards, but I never felt compelled to move to it. Grammars in SableCC are quite clean, and the generated parser produces a nice AST that is quite easy to traverse.

Here is the grammar for TextUML:

> <https://github.com/abstratt/textuml/blob/master/plugins/com.abstratt.mdd.frontend.textuml.grammar/textuml.scc>

---

<div class="post-metadata">

### Author: ![adrua](https://d.strumenta.community/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@adrua](https://d.strumenta.community/u/adrua)
#### Post date: [August 21, 2020, 1:50pm UTC](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233/60 "2020-08-21T13:50:01Z")

</div>

HI,

I’m using GPPG Parser (Golden Point Parser Generator) compatible with Yacc/Lex and generate C#

Mi pain is remove issues Displacement/Reduce and how build AST. (My ASTs are XML)

Good luck

[Previous page](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233.md?page=2)

[Next page](https://d.strumenta.community/t/which-parser-generator-are-you-using-if-any/233.md?page=4)
