Hacker News new | past | comments | ask | show | jobs | submit login

> would recommend looking into writing a grammar, have that generate your AST, then do some transformations on the AST to generate code. you will save a lot of time.

I had this thought, so I used a parser combinator (mpc) to generate the AST from the grammar and source file, then extract useful elements from the AST for codegen.




With mpc you can support macros, adding better macro definitions at compile-time, not just primitive cpp-style replacements. This would be definitely a game changer.


Will definitely follow up on this. Maybe we could support DSLs while at it?


Yes, a bit like perl6 grammars. Just performant.


And immutable? Aka, you could not create a DSL that would allow you to create other DSL inside of it?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: