Hi,

I'm designing a language and would like some tips from more experienced
people on the process of compilation.

I have my language grammar outputting AST with CSharp2 target. I would like
to add some compilation warnings and errors to the process. Previously, I
added a bunch of actions to the lexer/parser grammar to check the parsed
strings. But it seems this tends to get very clumsy as you add more
checks...

So I thought about separating the process into 3 tree pattern matchers with
the following actions:

1st - give errors for invalid operations (things that I can only see after
the tree is constructed)
2nd - warn as much as possible about dangerous situations
3rd - optimize/rewrite whatever possible

So, I generate the AST, pass through the 3 walkers, and finally compile the
code.


My questions are:

1. Is this a good design? Am I separating too much? Am I not separating
enough?
2. Can I still give detailed errors with line numbers/char positions even if
the exception comes from another grammar or the tree was rewritten?


Any other comments regarding the process are welcome.

Thanks!

--

You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to