[il-antlr-interest: 34133] Re: [antlr-interest] Binary support

2011-09-23 Thread Loring Craymer
ANTLR is overkill for binary file formats:  I know of no binary file format that requires more than one (variable length) item of lookahead for processing, nor would I expect to find one--binary formats are intentionally designed and evolved. It is fairly simple to design a language for

[il-antlr-interest: 33244] Re: [antlr-interest] Deciphering the TreeWalker error message ...

2011-07-20 Thread Loring Craymer
UP and DOWN tokens (start/end of child list for tree) do not have location information attached so no line/column error reporting.  Mostly the error says that you started a subtree that your grammar does not match, probably an LPAREN or RPAREN rooted subtree from your report of cases where you

[il-antlr-interest: 33107] Re: [antlr-interest] Can one identify the type of parser needed for a given BNF grammar

2011-07-11 Thread Loring Craymer
And then you have to figure out how to prune the GLR-generated forests. C++ is nasty; it can be parsed with ANTLR (as shown by NEXT and David Wigg's adaptions of that grammar), but I believe that the right strategy with ANTLR is actually to use multi-pass recognition to sort out the

[il-antlr-interest: 33113] Re: [antlr-interest] Can one identify the type of parser needed for a given BNF grammar

2011-07-11 Thread Loring Craymer
On 3.) : The parser just recognizes syntax and ignores semantic ambiguities; then in a first tree walker pass, the symbol tables are constructed; a second tree walker pass uses the symbol table information to resolve ambiguities (which of several interpretations of valid syntax is correct)

[il-antlr-interest: 33130] Re: [antlr-interest] Can one identify the type of parser needed for a given BNF grammar

2011-07-11 Thread Loring Craymer
with language translation, and a bit of book learning would not be out of order. --Loring From: Douglas Godfrey douglasgodf...@gmail.com To: Loring Craymer lgcray...@yahoo.com Cc: The Researcher researcher0...@gmail.com; antlr-interest@antlr.org Sent: Monday, July 11

[il-antlr-interest: 32419] Re: [antlr-interest] Translating expressions - advice?

2011-05-09 Thread Loring Craymer
Optimal placement of parentheses is tricky; as a first step, you want to use the form ^('+' A B C D E F ) as long as the operator is associative; then you want to parenthesize only when required to by changes in operator precedence; the easiest way is actually to have two versions of each

[il-antlr-interest: 32071] Re: [antlr-interest] Examples of semantic predicates with extremely long generated code

2011-04-04 Thread Loring Craymer
Sam-- Are you working on the SemanticContext classes for this? That seems to be where the problem originates--no effort is made to refactor generated trees. --Loring - Original Message From: Sam Harwell sharw...@pixelminegames.com To: Terence Parr pa...@cs.usfca.edu;

[il-antlr-interest: 32032] Re: [antlr-interest] Fwd: F77 grammar

2011-03-31 Thread Loring Craymer
You probably want to check out http://fortran-parser.sourceforge.net/. --Loring - Original Message From: piet...@agh.edu.pl piet...@agh.edu.pl To: antlr-interest@antlr.org Sent: Thu, March 31, 2011 12:24:19 AM Subject: [antlr-interest] Fwd: F77 grammar Hi, I have problem

[il-antlr-interest: 32012] Re: [antlr-interest] Spaces issues

2011-03-29 Thread Loring Craymer
The likely cause of your problems is the extensive use of fragment rules. ANTLR 3 does not use follow sets in lexers and invocation of fragment rules usually disables LL* processing. Inline your fragment rules, and your current problems should disappear, although others may still lurk.

[il-antlr-interest: 32021] Re: [antlr-interest] Spaces issues

2011-03-29 Thread Loring Craymer
the issue. This is strange to me as it was not used in the rule litteralRange. Does anyone know how is this possible ? Thanks for your help Fabien. Le 29/03/11 19:53, Loring Craymer a écrit : The likely cause of your problems is the extensive use of fragment rules. ANTLR 3 does

[il-antlr-interest: 31373] Re: [antlr-interest] Error message requires key press to continue

2011-02-07 Thread Loring Craymer
Vocabulary import uses StreamTokenizer in Grammar.importTokenVocabulary(String vocabName). There is a minor bug in that error recovery consumes tokens until TT_EOL is found; that should be either TT_EOL or TT_EOF. You might try fixing that and reporting if the fix works. --Loring -

[il-antlr-interest: 30213] Re: [antlr-interest] Whitespace is significant sometimes

2010-09-28 Thread Loring Craymer
This is the sort of problem that can be solved with lexer modes. ANTLR 3 does not support lexer modes, however, so the usual approach is two phase parsing, where the first pass would parse text outside of [ ] but recognizes [ ... ] constructs as single tokens. The second pass processes the

[il-antlr-interest: 30155] Re: [antlr-interest] comparing two parse trees

2010-09-14 Thread Loring Craymer
This involves algebraic rewrites; you want to extend an algebraic normal form (see wikipedia article) to include exponentiation and express division in terms of negative exponents and compare formulae after conversion to normal form. And you probably want to do constant folding (another

[il-antlr-interest: 29140] Re: [antlr-interest] Parsing whole-line comments?

2010-06-06 Thread Loring Craymer
You can, of course, do COMMENT : '\n' 'C' (~'\n')+ ; NEWLINE: '\n' ; (the ordering matters for ANTLR 3's DFA construction), but the approach Brodie suggested is the common idiom since it costs less in terms of performance and does not depend on the quirks of ANTLR DFA construction. Start of

[il-antlr-interest: 29048] Re: [antlr-interest] short circuiting further evaluation

2010-05-30 Thread Loring Craymer
...@antlr.org;antlr-interest-boun...@antlr.org [mailto:antlr-interest- href=mailto:boun...@antlr.org;boun...@antlr.org] On Behalf Of Loring Craymer Sent: Saturday, May 29, 2010 3:26 PM Don't walk the tree to evaluate the expression; walk the tree to generate byte code

[il-antlr-interest: 29052] Re: [antlr-interest] short circuiting further evaluation

2010-05-30 Thread Loring Craymer
- Original Message From: Jane Eisenstein ja...@softweave.com To: Loring Craymer lgcray...@yahoo.com Cc: Jim Idle j...@temporal-wave.com; antlr-interest@antlr.org antlr-interest@antlr.org Sent: Sun, May 30, 2010 5:08:12 PM Subject: Re: [antlr-interest] short circuiting further evaluation

[il-antlr-interest: 29041] Re: [antlr-interest] short circuiting further evaluation

2010-05-29 Thread Loring Craymer
Don't walk the tree to evaluate the expression; walk the tree to generate byte code and then interpret the byte code. The overall problem then gets simpler and the resulting code runs faster. --Loring - Original Message From: Jane Eisenstein ja...@softweave.com To: Farr, John

[il-antlr-interest: 28523] Re: [antlr-interest] Moving from SableCC to ANTLR; What are tree grammars?

2010-04-03 Thread Loring Craymer
Tree grammars describe AST processors, and are more powerful than visitors since they recognize token sequences as productions. See http://www.antlr.org/article/1100569809276/use.tree.grammars.tml. --Loring - Original Message From: Tyler Distad tyler.dis...@gmail.com To:

[il-antlr-interest: 28058] Re: [antlr-interest] ANTLR IDE 2.0.0 is out!!

2010-02-23 Thread Loring Craymer
ECL is commercially friendly, and shows lots of work by the IBM lawyers to build a license for a flagship open source project done for commercial reasons. IBM's Websphere development platform is the commercial version of eclipse. --Loring - Original Message From: Terence Parr

[il-antlr-interest: 27945] Re: [antlr-interest] setting k Value Versus Predicates

2010-02-16 Thread Loring Craymer
the target developers have to follow the Java changes. I don't use ANTLRWorks, so I can't say much more than this. --Loring From: Gokulakannan Somasundaram gokul...@gmail.com To: Loring Craymer lgcray...@yahoo.com Sent: Mon, February 15, 2010 11:15:44 PM Subject: Re: [antlr-interest] setting k Value

[il-antlr-interest: 27879] Re: [antlr-interest] Newbie, rapidly losing mind

2010-02-10 Thread Loring Craymer
Well, it is possible that there is an analysis bug, but it is more likely that the rule you deleted invoked other rules in a fashion that caused the ambiguity. There is no such thing as a non reachable rule: any rule could be an entry rule (that is, one invoked from target language code, not

[il-antlr-interest: 27663] Re: [antlr-interest] Anyone in the whole world doing multi step tree transformation?

2010-01-24 Thread Loring Craymer
Oliver-- Some key points: 1.) Capture semantics rather than designing tree structures. 2.) Preserve grammar structure--that is, rule a in pass n becomes rule a in pass n+1 unless there is reason to do otherwise. 3.) Avoid cluttering your grammars with action code. 4.) Separate analysis