This project has moved and is read-only. For the latest updates, please go here.

cell problem again

Feb 6, 2012 at 3:20 PM

Before someone reminds me,- I read the discussion about the excel cell already.

Forget it as an excel cell problem. The issue itself is very basic as in my example:


var columnLetter = new RegexBasedTerminal("columnLetter", @"\$?([A-Z]$|([A-I][A-V]$))");

var row = new RegexBasedTerminal("row", @"\$?\d{1,5}");

var formula = new NonTerminal("formula");

var cell = new NonTerminal("cell");

var expression = new NonTerminal("expression");

formula.Rule = ToTerm("=") + expression;

cell.Rule = columnLetter + row;

expression.Rule = cell;

this.Root = formula;


Irony simple refuses to know an expression like A23 or $A$23. Please somebody tell me that there is a mistake in my code.

If this example would be to much to solve for Irony, I would have set my hopes on the wrong horse. No hard feelings, just what it means.

Feb 6, 2012 at 7:20 PM

My guess - when you specify cell as "columnLetter + row", Irony assumes that there's some delimiter between these two tokens, like space. That's what normally happens - terms are separated by delimiters. I suggest you use one Regex terminal for row-col combination. Or even better. Use Identifier terminal instead (add $ as an extra "first" char in constructor); then hook to ValidationToken event and check the string using regex or some custom code. I strongly discourage using regex terminal, in general - it is tricky, and quite slow. 

If you want to keep your original code, then go in step mode in debugger and see why the input is rejected - that might give you a clue why it is failing, and how to fix it. 


Feb 9, 2012 at 11:09 AM


Thank you for your quick reply. I understood the non delimiter problem and made a terminal 'cell'. That works fine for me so far.

I've seen yesterday that there was an implementation of an 'ImpliedSymbolTerminal'( It seems it's deleted. What happened to it?


Still I use RegexBasedTerminal because I need a very detailed description of the terminals. I cannot see how to do that with Identifier. Because biggest problem with Irony is that there is very pure documentation. I'm simple not aware of the possibilities.

Through this I face a few problems:

1. I get an grammar conflict that I do not understand: "Reduce-reduce conflict. State S52, lookaheads: EOF...Selected reduce on first production in conflict set."

State S52 (Inadequate)  Shift items:    range -> cell ·: cell   Reduce items:    page_param -> cell · [EOF ) ; + - / * % < <= > >= =]    range -> cell · [EOF ) ; + - / * % < <= > >= =]  Transitions: :->S37,

2.  I know it is possible to strip the tree to just the information I really want to see. Again, I do not exactly how.

It all comes down to lag of information.


Feb 9, 2012 at 5:26 PM

ImpliedSymbolTerminal is still there, look under Parsing/Terminals folder

The conflict - it means that grammar is ambiguous, at least the way you expressed it. The parser has more than one way to go in the state S52 - two reduce productions, for a given lookahead symbol (EOF). Look closely at productions - the "cell" followed by EOF might be interpreted either as page_param, or as "range"; try to see how to remove ambiguity by modifying rules for page_param and/or range

Stripping to info "you just want to see" - not quite understand. The parse tree is a representation of the input as a tree. You can get rid of punctuation symbols automatically, or with non-terminals you can register some as "transient", so they will be removed and replaced by the direct child. That's all auto-stripping facilities.