ridencww / goldengine

Java implementation of Devin Cook's GOLD Parser engine
Other
35 stars 14 forks source link

No rule handler for rule #8

Closed ashkotin closed 10 years ago

ashkotin commented 12 years ago

I have got message

No rule handler for rule ::= Declaration Id sort .

But I have this handler (RuleHandler13.class) in my folder (\prenex_FOLsn) for handlers.

What should I do?

ridencww commented 12 years ago

Can you include the top of RuleHandler13.java (the part with the annotation declaration)? Is the rule in the grammar file have the period quoted?

 ::= Declaration Id sort .
-OR-
 ::= Declaration Id sort '.'
ashkotin commented 12 years ago

It was

::= Declaration Id sort '.'

and I have changed to

::= 'Declaration' Id 'sort' Dot and have got No rule handler for rule ::= Declaration Id sort Dot RuleHandler13.java is attached. Alex 2012/9/18 Ralph Iden notifications@github.com > Can you include the top of RuleHandler13.java (the part with the > annotation declaration)? Is the rule in the grammar file have the period > quoted? > > ::= Declaration Id sort . > -OR- > ::= Declaration Id sort '.' > > — > Reply to this email directly or view it on GitHubhttps://github.com/ridencww/goldengine/issues/8#issuecomment-8666721.
ashkotin commented 12 years ago

I have responded from my google email web-client and it looks like attachment lost. Here you are:

package prenex_FOLsn; //========================================================================= //RULE HANDLER CLASS BEGINS =============================================== //=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException; import com.creativewidgetworks.goldparser.engine.Reduction; import com.creativewidgetworks.goldparser.parser.GOLDParser; import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append // a comma to each quoted production description except for the last. @ProcessRule(rule={ " ::= Declaration Id sort '.'"
})

/**

//========================================================================= //RULE HANDLER CLASS ENDS ================================================= //=========================================================================

ashkotin commented 12 years ago

And even more interesting: when I have created small grammar (2 rules) just to check ¬ - everything does work!

ridencww commented 12 years ago

I am assuming that the GOLD Builder isn't reporting any errors with your grammar making it an issue with either the way the template is being built or the Java engine itself.

Could you send along the part of your grammar file that defines that rule, if not the entire grammar? It appears that the left hand side is missing (note the space before ::=) and I'd like to understand what is happening.

ashkotin commented 12 years ago

Rule itself is

::= 'Declaration' Id 'sort' Dot I play around a little as now grammar has 59 rules. Alex 2012/9/24 Ralph Iden notifications@github.com > I am assuming that the GOLD Builder isn't reporting any errors with your > grammar making it an issue with either the way the template is being built > or the Java engine itself. > > Could you send along the part of your grammar file that defines that rule, > if not the entire grammar? It appears that the left hand side is missing > (note the space before ::=) and I'd like to understand what is happening. > > — > Reply to this email directly or view it on GitHubhttps://github.com/ridencww/goldengine/issues/8#issuecomment-8822128.
ridencww commented 12 years ago

I haven't been able to duplicate the problem, but it may be related to the UTF-8 issue. I will be posting an updated engine soon with better UTF-8 support. I presume your 59 rules are being processed correctly. However, if you encounter this problem again, I would like a copy of the grammar file so I can see where the problem is being generated.

ashkotin commented 12 years ago

OK. But I need some time to play with my grammar myself:-)

2012/9/26 Ralph Iden notifications@github.com

I haven't been able to duplicate the problem, but it may be related to the UTF-8 issue. I will be posting an updated engine soon with better UTF-8 support. I presume your 59 rules are being processed correctly. However, if you encounter this problem again, I would like a copy of the grammar file so I can see where the problem is being generated.

— Reply to this email directly or view it on GitHubhttps://github.com/ridencww/goldengine/issues/8#issuecomment-8878745.

ridencww commented 11 years ago

Closing this issue because I can't duplicate the problem.

roderickgreen commented 10 years ago

I am having this problem as well. Oddly, I only see it when I set 'wantTree' to false, and only on the '-' operators. Parsing "A + B;" succeeds but "A - B;" fails with: "No rule handler for rule <add> ::= <add> - <unary>." If I manually unquote the '-' in the generated annotation it parses fine. A grammar that displays the problem is below. I would appreciate if you could take a look at this. -- Rod

GOLD Parser Builder version 5.2, goldengine version 5.0.3 from maven.

"Name"    = 'C-Expression'
"Start Symbol" = <program>

ID          = {Letter}+

<program>
        ::= <expr> ';'

<expr>
        ::= <add>

<add>
        ::= <add> '-' <unary> 
         |  <add> '+' <unary> 
         |  <unary> 

<unary>
        ::= '-' <value> 
          | '+' <value>
          |  <value>

<value>
        ::= ID
ridencww commented 10 years ago

Thank you for providing a grammar that exposes the problem. I have confirmed the inability to retrieve the rule because of the single quote marks. I will write a failing test, fix the code, and prepare a new release. Allow me a day or two to get this done.

roderickgreen commented 10 years ago

No hurry, thanks for the help!

ridencww commented 10 years ago

I have identified the issue, wrote a test exposing it, and fixed the problem. I want to have another look tomorrow to make sure that I'm not imposing constraints on when a token needs to be quoted. I plan on committing the code, building the library, and pushing to the Maven Central Repository tomorrow.

ridencww commented 10 years ago

Thanks to roderickgreen, a defect the Java engine was identified and corrected. GOLDEngine 5.0.4 is now ready for consumption. Source on GitHub, jars at the Maven Central repository, and available from the link on the README.md. All should be well now, but check it out and confirm the fix.

roderickgreen commented 10 years ago

I can confirm the issue is fixed in 5.0.4. Thanks again for your help, and for providing this code!

ridencww commented 10 years ago

Thank you for providing the grammar that exposed this! I had a go at this two years ago, but couldn't duplicate the issue. I hope you get some good use from the engine and Devin Cook's GOLD Builder. Closing this issue.