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


Mar 16, 2013 at 6:56 PM
I am new to irony and using it in my M.Sc thesis to write a grammar for OCL+EMOF and HUTN
Since here is many combination the duplicaci is ovious but the nonterminal maintain a hierarchy like object oriented inheritance.For implementing i have got many reduce-reduce conflict .I can eliminate that if i can shift forward.

Any body please help me on doing that.Browsing on the discussion I get ReduceHere ,ReduceIf, ShiftIf but I could not use these.Roman Ivantsov and others lease give me an example on using these.
Mar 17, 2013 at 6:04 AM
well, if you're new to Irony, my guess is that you're new to parsing and LALR parsing. Pay your dues, learn how it works, algorithm-wise, first. Read wikipedia articles, there are lots of introductory guides on the web about this. For printed books my recommendation is Parsing Techinuques, 2nd ed - find it on amazon.
You 'got many conflicts' - something tells me that your grammar is not well composed, you have to refactor it to remove 'duplicate' paths in parsing - that's long before you turn to ReduceHere, ReduceIf and other hints. Irony grammar definitions look simple, but you HAVE to know the theory to use these facilities.
Good luck
Mar 21, 2013 at 6:28 PM
At the start I have 25 error and it reduced to 1.The error is

"Shift-reduce conflict.State S65. lookaheads [:] selected shift as preferred action."

the state is

State S65 (Inadequate)
Shift-reduce conflicts on inputs: :
Shift items:
classContextSignature -> context Identifier ·: type 
Reduce items:
fullType -> Identifier · [:: : inv invariant def Identifier]
Transitions: :->S97

The fullType nonterminal is

fullType.Rule= MakePlusRule(fullType , scopeIn,identifier);

and the scopeIn is "::"

I have a token ":" and in other case I have solved it by using PreferShiftHere() but

fullType.Rule= MakePlusRule(fullType,PreferShiftHere()+scopeIn,identifier);

does not work here.

Please anybody help me.
Mar 22, 2013 at 5:34 PM
It's hard to say from these few rules you provide, the conflict comes for OTHER rules that result in conflicting parsing routes. Please post the entire grammar if it's possible.
One note about use of hints (PreferShiftHere(), ShiftIf() etc) - do not use them just to make the conflict go away, this only hides the problem, but it will reappear when you start actual parsing, and then fixing it would be much more difficult. Make sure you understand what conflict means, and try to fix it by rearranging the grammar. It is only if you are confident that the conflict is in the ambiguity of the language (like 'dangling else' problem), and there's a clear rule about correct way of parsing (like 'always treat else as belonging to the nearest if') - then express this rule through the hint.