Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Grmr2JavaReport"
Line 1: | Line 1: | ||
== Generation of Java from Grammar file == | == Generation of Java from Grammar file == | ||
− | This article describes the issues | + | This article describes the issues faced, while working on the generation of Java code from a grammar file using [[Gymnast]], [[Emfatic]] and [[Grammar2Ecore]] frameworks. |
== Initial conditions == | == Initial conditions == | ||
− | * Eclipse plug-in project with a grammar file (SVG5.ast) is open as shown in Figure 1 | + | * Eclipse plug-in project with a grammar file (SVG5.ast) is open as shown in Figure 1. Grammar file has a value for parserGenerator option as javacc. |
* srcGymnast (in Figure 1) is the source folder to which Gymnast runtime core plug-in is added manually. Please refer [https://bugs.eclipse.org/bugs/show_bug.cgi?id=233805 "Bugzilla entry 233805"] | * srcGymnast (in Figure 1) is the source folder to which Gymnast runtime core plug-in is added manually. Please refer [https://bugs.eclipse.org/bugs/show_bug.cgi?id=233805 "Bugzilla entry 233805"] | ||
<table border="0" cellpadding="8"> | <table border="0" cellpadding="8"> | ||
Line 12: | Line 12: | ||
<caption align="bottom"><b>Figure 1 </b> Project Explorer view </caption> | <caption align="bottom"><b>Figure 1 </b> Project Explorer view </caption> | ||
</table> | </table> | ||
− | * Dependent Plug-ins are added in the MANIFEST.MF file. | + | * Dependent Plug-ins are added in the MANIFEST.MF file. Hence right clicking on the grammar file shows options like 'Generate .genmodel and Java', 'Generate .genmodel' etc. Refer Figure 2. |
<table border="0" cellpadding="8"> | <table border="0" cellpadding="8"> | ||
<tr> | <tr> | ||
Line 19: | Line 19: | ||
<caption align="bottom"><b>Figure 2 </b> Context menu for grammar file </caption> | <caption align="bottom"><b>Figure 2 </b> Context menu for grammar file </caption> | ||
</table> | </table> | ||
+ | |||
+ | == Issues == | ||
+ | This section describes the issues faced and the workaround for the same. | ||
+ | ==== Parser error in Gymnast generated Javacc file ==== | ||
+ | After checking the well-formedness for the grammar file, click on 'Generate AST' from the context menu. Gymnast generates AST and Parser packages in the 'src' folder (refer Figure 3). Open the Gymnast generated Javacc file (in this case, file svg.jj in the parser package). The Outline view in eclipse shows parser error. This is because Gymnast additionally adds the word "public" in the generated JavaCC file. | ||
+ | <table border="0" cellpadding="8"> | ||
+ | <tr> | ||
+ | <td>[[Image:Grmr2JavaReport3.jpg]]</td> | ||
+ | </tr> | ||
+ | <caption align="bottom"><b>Figure 3 </b> Parser error in JavaCC </caption> | ||
+ | </table> | ||
+ | |||
+ | Workaround is to manually removing the additional word "public" that causes the parser error. | ||
+ | |||
+ | ==== A smaller subsection ==== | ||
+ | ==== A smaller subsection ==== | ||
+ | ==== A smaller subsection ==== |
Revision as of 11:18, 24 May 2008
Contents
Generation of Java from Grammar file
This article describes the issues faced, while working on the generation of Java code from a grammar file using Gymnast, Emfatic and Grammar2Ecore frameworks.
Initial conditions
- Eclipse plug-in project with a grammar file (SVG5.ast) is open as shown in Figure 1. Grammar file has a value for parserGenerator option as javacc.
- srcGymnast (in Figure 1) is the source folder to which Gymnast runtime core plug-in is added manually. Please refer "Bugzilla entry 233805"
- Dependent Plug-ins are added in the MANIFEST.MF file. Hence right clicking on the grammar file shows options like 'Generate .genmodel and Java', 'Generate .genmodel' etc. Refer Figure 2.
Issues
This section describes the issues faced and the workaround for the same.
Parser error in Gymnast generated Javacc file
After checking the well-formedness for the grammar file, click on 'Generate AST' from the context menu. Gymnast generates AST and Parser packages in the 'src' folder (refer Figure 3). Open the Gymnast generated Javacc file (in this case, file svg.jj in the parser package). The Outline view in eclipse shows parser error. This is because Gymnast additionally adds the word "public" in the generated JavaCC file.
Workaround is to manually removing the additional word "public" that causes the parser error.