| Home
Introduction
Operation Schemas
User Manual
Directory Structure
Parser
Model Extractor
Type Checker
Modifications
Extending the Compiler
Outstanding Issues
Current Status
References and Links
Javadoc |
Extending the Compiler
Modifications in the grammar:
This will require the following steps:
-
Make sure the modified grammar file is in the directory
containing the lglepfl directory, and the first line of the grammar file
is "package lglepfl.ocl.parser".
-
Remove the following directories: lglepfl\ocl\parser\parser,
lglepfl\ocl\parser\lexer,
lglepfl\ocl\parser\analysis
and
lglepfl\ocl\parser\node. Make sure that the files contained
in the
lglepfl\ocl\parser directory are not bothered.
-
Make sure that the classpath contains the directory
containing the SableCC class. For example, if the SableCC class
file, along with all associated files and subdirectories, is present in
the Z:\sablecc\sablecc-2.13 directory, then the classpath should contain
Z:\sablecc\sablecc-2-13. Also the xerces.jar file must be in classpath
(as explained in User Manual).
-
Run SableCC with the following command: "java SableCC
current.grammar" if current.grammar is the name of the grammar file.
-
Compile all the .java files in the four sub-directories
of lglepfl\ocl\parser generated by SableCC (or just run the make file present
the parent directory of lglepfl).
-
Check if any of the classes inheriting from the depth
first traversal classes need to be modified, and modify them accordingly.
Currently, the following classes inherit from the depth
first traversal classes, along with the grammar rules changes in which
also probably need changes to these classes.
-
ASTFix (inner class of lglepfl.ocl.parser.OclParser):
will need to be changed if the grammar rule for FeatureCallParameters,
or any of it’s immediate children is changed.
-
lglepfl.ocl.ASTTextGenerator: independent of
the grammar.
-
NameReserver (inner class of lglepfl.ocl.NameCreator):
may need to be changed if the rules for PostDecl, LetExpression, StandardDeclarator
or IterateDeclarator are modified
-
ASTCheck (inner class of lglepfl.ocl.parser.OclParser):
may need to be changed if the rule for IfExpression is changed.
-
lglepfl.ocl.OnlyNameFinder: may need to be modified
in case of changes to rules involving any type of expression (e.g, expression,
LetExpression, AdditiveExpression etc.).
-
lglepfl.ocl.Visualizer: independent of the grammar.
-
lglepfl.ocl.check.TypeChecker: will need to be
modified for changes to almost any grammar rule.
-
lglepfl.ocl.check.types.xmifacade.XMIParser.java,
lglepfl.ocl.check.types.xmifacade. Model.java
and lglepfl.ocl.check.types.xmifacade.ModelClass.java needs to be
modified if the tool generating the XMI files uses a format different from
Rose 2001. Generally, tools use different ways of handling Associations,
Stereotypes and Classes. Most the changes will have to be made to XMIParser.java
as it contains hard-coded XMI tags.
It is recommended that the files be modified in the above mentioned
order. As the TypeChecker class depends heavily on the grammar it
is recommended that the class be modified only when no more changes are
to be made to the grammar.
|