Generation of AST for semantic rule checking

thedeemon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 22 23:30:50 PDT 2016


On Sunday, 22 May 2016 at 04:33:44 UTC, Chris Katko wrote:
> Basically, I want compile-time enforcement of semantic rules.

> So the question is: Is there a way to get LDC2 to generate AST 
> or similar, and if not, any other way to go about this?

I think one popular approach to the task is to use linters / 
static analysis tools before compiling, as a build step or 
separately. There is this project:
https://github.com/Hackerpilot/Dscanner
that uses a D parser to get AST and applies different semantic 
checks, you could use that as a base and just add your own checks 
and conditions.


More information about the Digitalmars-d-learn mailing list