ANTLR - Embedding Java code, evaluate before or after?
Posted
by wvd
on Stack Overflow
See other posts from Stack Overflow
or by wvd
Published on 2010-05-01T11:47:23Z
Indexed on
2010/05/01
11:57 UTC
Read the original article
Hit count: 268
Hello all,
I'm writing a simple scripting language on top of Java/JVM, where you can also embed Java code using the {} brackets. The problem is, how do I parse this in the grammar? I have two options:
1] Allow everything to be in it, such as: [a-z|a-Z|0-9|_|$], and go on
2] Get an extra java grammar and use that grammar to parse that small code (is it actually possible and efficient?)
Since option 2] is basically a double-check since when evaluating java code it's also being checked. Now my last question is -- is way that can dynamically execute java code also with objects which have been created at runtime?
Thanks,
William van Doorn
© Stack Overflow or respective owner