Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Grammar2Ecore"

Line 20: Line 20:
 
<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>
 +
 +
== Steps for Grammar to Java converstion ==
 +
This section describes the steps involved in the conversion of grammar file to Java code, along with the generation of .genmodel and .ecore. Pproblems like compilation errors, missing files etc., may occur at some of the steps in the grammar to Java conversion process. These problems are documented in [[Grmr2JavaReport]], along with the possible workarounds/solutions.
 +
 +
====  Step 1: Generate AST ====
 +
From the context menu of the grammar file,
 +
 +
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====
 +
====  JavaCC options for the project ====

Revision as of 07:46, 25 May 2008

How to use Grammar to Ecore Generator

This article describes the steps involved in the generation of .genmodel, .ecore and Java from a grammar file using Gymnast, Emfatic and Grammar2Ecore frameworks.

Initial conditions

  • Eclipse plug-in project with a sample grammar file (in this example, SVG.ast) exists as shown in Figure 1.
  • JavaCC or Antlr can be used as Parser Generators.
  • srcGymnast (in Figure 1) is the source folder to which Gymnast runtime core plug-in is added manually. Please refer "Bugzilla entry 233805"
Grammar2Ecore1.jpg
Figure 1 Project structure
  • 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.
Grammar2Ecore2.jpg
Figure 2 Context menu for grammar file

Steps for Grammar to Java converstion

This section describes the steps involved in the conversion of grammar file to Java code, along with the generation of .genmodel and .ecore. Pproblems like compilation errors, missing files etc., may occur at some of the steps in the grammar to Java conversion process. These problems are documented in Grmr2JavaReport, along with the possible workarounds/solutions.

Step 1: Generate AST

From the context menu of the grammar file,


JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

JavaCC options for the project

Back to the top