Hi, Antlr fellows:
I wrote a simple parser and a weak runtime to make a prototype of our DSL. I
followed the de-facto definition steps:
1. Define a lex grammar to describe tokens.
2. Define a parser grammar to describe syntax and build an AST.
3. Define a tree grammar to genereate DSL source code via StringTemplate
which includes my hand-written execution code as runtime.
Now I want to run this DSL code in Eclipse directly. So I must let DSL
support debugging. I must embbed a hook function in every start of a
statement. I named this function 'breakpoint', it need a line number as
argument.
For example, there's a "x=1" statement in my DSL where AST is ^(ASSIGN, x,
1) . I insert a function like below:
assignStmt @init{
breakpoint(Problem: how to get line number here?);
} : ^(ASSIGN, ID, INT) {
.....//Omitted
}
I don't know how to get line number at the start of a statement, further, I
doubt whether this method is correct.
Thank for you help!
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
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.