On 6/12/15 10:26 AM, deadalnix wrote:

This baffles me. It seems that language designer always need to fuck up
macros either by:
  - Creating a new API to spawn AST, which become a burden on the
compiler development (bonus point if you expose compiler internal).
  - Creating a new syntax, preferably completely inscrutable so you can
pretend you are a guru while using it.

There is a good way to express AST in a language, and this is how you do
it for everything else in the program : you use the damn language syntax
and grammar.

In their defense, there is a need for a metalanguage as well do manipulate ASTs themselves. That's why all macro systems just look a bit off. I suggest you give it a shot at defining a natural-looking macro system if you're up to something, but I suspect there are many subtleties to cope with.

Andrei

Reply via email to