Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple language parser generator

What parser generator can take a single grammar and create a parser in both C# and JavaScript?

ANTLR I have yet to get into Visual Studio (outdated documentation and packages). The goal is manage a single grammar for a subset of SQL (SELECT statements and new keywords specific to my problem domain) but generate two parsers (C#/JavaScript).

like image 893
JesseBuesking Avatar asked Jul 23 '26 12:07

JesseBuesking


2 Answers

Is there a parser generator that can take a single grammar and create a parser in both c# and javascript?

The only one I am aware of is ANTLR. Note that ANTLR will not generate both a JavaScript- and C# based parser in one go though. You will have to change (at least) one option in the grammar and invoke org.antlr.Tool to generate a parser for your other target language.

I've tried using ANTLR, but I have yet to get it into Visual Studio

Then don't use Visual Studio, but use your favorite text editor (and use org.antlr.Tool from the console), or ANTLRWorks.

like image 141
Bart Kiers Avatar answered Jul 25 '26 02:07

Bart Kiers


There's canopy, which targets javascript, ruby, java, and python from PEG

like image 28
John Haugeland Avatar answered Jul 25 '26 01:07

John Haugeland