Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [imp-dev] Moving SADL project to new version of IMP--problem with SADLLexer.java


Hi Andy,

I don't know specifically what might have happened for you to have run into this change.  And I'm not an expert on all of the ins and outs of LPG-related processing.  But, the difference that you report between your older and new lexers is probably related to the use of a different template.

As you know, when you run the "New LPG Grammar with Parser Wrapper for IMP", you get one .g file and two .gi files.  These files have options specified at the beginning, and some of the options relate to templates to be used by LPG in generating Java code.  The lexer.gi file generated by the wizard usually contains an option "%options template=LexerTemplateF.gi."

If you look in org.eclipse.imp.lpg.metatooling/templates (if you have that handy), you can see that there are a number of lexer related templates.  The template "LexerTemplateF.gi" contains code like that in your older lexer (i.e., with the static class).  The template "LexerTemplate.gi" contains code like that in your newer lexer (lacking the static class).  Can you check on which lexer template is referred to in the option in your lexer.gi file?

As far as I know, the option should still be referring to LexerTemplateF.gi.  And that's what I get when I run our demo on my machine.  My newly generated lexer still looks the way your lexer used to.

I hope that helps.

Stan


Stan Sutton, Ph. D.
IBM T. J. Watson Research Center
19 Skyline Drive, Hawthorne, NY 10532 USA
telephone:  1-914-784-7316, FAX:  1-914-784-7455, T/L 863
e-mail:  suttons@xxxxxxxxxx, Stan Sutton/Watson/IBM@IBMUS



"Crapo, Andrew (GE, Research)" <crapo@xxxxxx>
Sent by: imp-dev-bounces@xxxxxxxxxxx

06/18/2008 10:25 AM

Please respond to
IMP Developers List <imp-dev@xxxxxxxxxxx>

To
<imp-dev@xxxxxxxxxxx>
cc
Subject
[imp-dev] Moving SADL project to new version of IMP--problem with        SADLLexer.java





Hi,

To move my SADL language project to the new version of IMP and Eclipse 3.3.2, I ran the "Programming language descriptor" and "New LPG Grammar with Parser Wrapper for IMP" wizards. The resulting code compiled and ran so I then started moving my code into the new project files. Everything compiles except the following:

SADLLexer.java
SADLParseController.java

The former does not compile because "SADLLexerLpgLexStream" is not defined. In the initial SADLLexer.java created by the wizard, the code around line 219 is:

    //
 
 //
 
 //
 
 static class SADLLexerLpgLexStream extends LpgLexStream
   {

 
 public final static int tokenKind[] =
   {

     
 Char_CtlCharNotWS,    // 000    0x00
               

where as the code now generated is:

    //
 
 //
 
 //
 
 public final static int tokenKind[] =
   {

       SADLLexersym.
Char_CtlCharNotWS,    // 000    0x00
               

In other words, the SADLLexerLpgLexStream class is no longer defined, which causes a number of related problems.

The SADLParseController.java file has an error in the "parse" method at the line:

                parser.reset(lexer.getLexStream());

because there is no "reset" method in the class SADLParser. This method was being generated in the Parser class initially, but now it is not. It is not defined in the SADLParser.g so must be added in the code generation process.

Note that the errors associated with these two files are the only ones shown in the Problems view, and the warnings are similar to those shown in an initally generated and functional plugin after running the two wizards.

This project's code (in its current, non-compiling state) is available at http://sadl.cvs.sourceforge.net/sadl/, if that is helpful. There have been enough changes in IMP, including the handling of package names for the project, that I thought it would be best to rebuild the plug-in piece by piece until full functionality is reached. This is the first stage. Your help in getting past these problems would be greatly appreciated.

Sincerely,
Andy Crapo

Andrew Crapo
GE Global Research

Information Scientist

T 518 387 5729
F 518 387 6104

D *833 5729

E crapo@xxxxxxxxxxxxxxx

www.research.ge.com

One Research Circle
Niskayuna, NY 12309 USA

General Electric Company
_______________________________________________
imp-dev mailing list
imp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/imp-dev


Back to the top