ES6 Parser in Dlang

Sönke Ludwig sludwig+d at outerproduct.org
Thu Feb 27 15:55:12 UTC 2020


Am 27.02.2020 um 15:06 schrieb James Lu:
> I want to implement an ES6 (JavaScript) parser in Dlang so I can 
> implement a transpiler. Because it's a transpiler, I need to be able to 
> visit and rewrite AST nodes, then generate code from the AST. Ideally, 
> the parser generator supports streaming the input into the AST visitor 
> out to the output.
> 
> What parser generator library should I use for this purpose?

There is also DMDScript, which is more or less ECMAScript v3. It should 
pretty straight forward to get that updated to v5, as there haven't many 
parser related changes (property getters/setters is an exception). I was 
already thinking of whether it makes sense to invest that work, because 
that would enable running the TypeScript compiler through it.

v6 has a few more parser related changes, but still nothing really bad. 
The DMDScript parser is in 
https://github.com/DigitalMars/DMDScript/blob/master/engine/source/dmdscript/parse.d

Higgs is much closer to ES6, though.


More information about the Digitalmars-d mailing list