[il-antlr-interest: 24444] Re: [antlr-interest] Suppress output of org.antlr.runtime.tree.TreeRewriter

2009-06-30 Thread Viktor Lioutyi
Hi Stefan, ANTLR comes with the source code. For issues like this I created patch.jar file with small fixes to ANTLR and put on a classpath before ANTLR jar files. For ANTLR 3.1.3 this output is in antlr-3.1.3/runtime/Java/src/main/java/org/antlr/runtime/tree/TreeRewriter.java, method pu

[il-antlr-interest: 24288] [antlr-interest] AST tree rewrite that can recognize sequence of nodes

2009-06-19 Thread Viktor Lioutyi
Hi, I submitted this post before, but in a wrong discussion thread. Sorry for the mess. I am resubmitting this post in a new thread with additional information. I am writing a prototype of converter from one language (TSL of WinRunner) to another (VB Script of QTP). One of the tasks includes

[il-antlr-interest: 24242] [antlr-interest] AST transformation for sequence of statements

2009-06-15 Thread Viktor Lioutyi
Hi, I am writing a prototype of converter from one language (TSL of WinRunner) to another (VB script of QTP). One of the task includes identification of statement sequence similar to one below int i = 0; A[i++] = e1; A[i++] = e2; ... A[i++] = eN; and rewriting it to something like that (the

[il-antlr-interest: 24129] [antlr-interest] How does . (dot) work in tree pattern matching?

2009-06-08 Thread Viktor Lioutyi
Tree pattern matching seems as an ideal tool for implementing sequence of AST transformations for a small project I am trying to prototype. A transformation must convert for-loop like this "for (int i = exp1; i <= exp2; i++) {..." to something like that "for i from exp1 to exp 2 {..." Below is a

[il-antlr-interest: 24127] Re: [antlr-interest] template rewrites

2009-06-08 Thread Viktor Lioutyi
I encountered the same problem and the best solution I found so far for literals: numeric_literal : INTEGER_LITERAL -> {%{$INTEGER_LITERAL.text}} | DECIMAL_LITERAL -> {%{$DECIMAL_LITERAL.text}} | FLOATING_POINT_LITERAL -> {%{$FLOATING_POINT_LITERAL.text}}