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:

  1. 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". 
  2. 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. 
  3. 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).
  4. Run SableCC with the following command: "java SableCC current.grammar" if current.grammar is the name of the grammar file. 
  5. 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). 
  6. 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.
  1. 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. 
  2. lglepfl.ocl.ASTTextGenerator: independent of the grammar. 
  3. NameReserver (inner class of lglepfl.ocl.NameCreator): may need to be changed if the rules for PostDecl, LetExpression, StandardDeclarator or IterateDeclarator are modified 
  4. ASTCheck (inner class of lglepfl.ocl.parser.OclParser): may need to be changed if the rule for IfExpression is changed. 
  5. 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.). 
  6. lglepfl.ocl.Visualizer: independent of the grammar. 
  7. lglepfl.ocl.check.TypeChecker: will need to be modified for changes to almost any grammar rule.
  8. lglepfl.ocl.check.types.xmifacade.XMIParser.java,

  9. 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.