This allows you to run the JavaCC compiler simply by right clicking on a *.jj file and selecting the compile option.
- Go to the "Help > Software Updates..." menu option.
- Open the "Available Software" tab
- Click "Add Site"
- Enter this url (http://eclipse-javacc.sourceforge.net/) in the location textbox, then click OK
- Expand the entry for the new site and its "Uncategorized" subtree.
- Check the "JavaCC Feature" checkbox, then click Install
- When the installation dialog opens, just click Next
- Accept the terms and click Finish
- Restart Eclipse
Create a project and set it up to use DemeterF. This setup is on a project by project basis, you need to do this for each project you create.
- Go to the "File > New > Java Project" menu item.
- In Contents section, select Create project from existing source
- Click Browse and select the folder you set up in Windows Explorer, click OK
- Name the project, then click the Next button
- Open the Libraries tab and click "Add External Jars..."
- Select the demeterf.jar and the IR2.0.jar (for the Relation class library) and click Open
- Click Finish
- Once the project opens, select the Run > Run Configurations... menu option
- Double click "Java Application" in the left pane to create a new Java Application run configuration
- Name the configuration DemFGen
- Check the "Include system libraries when searching for Main" checkbox, then click Search
- Type "DemFGen" in the search textbox to find the DemFGen class in the default package, click OK
- Open the arguments tab and enter your DemFGen arguments. For the example code Prof. Lieberherr usually uses the following:
--mutable --dgp:ToStr:Print:Display program.cd program.beh gen- Click Run (not Apply), and proceed even with the errors
- Refresh the project in the package explorer
- Expand the gen package (or whatever you named your output folder)
- Right click theparser.jj and select "Compile with JavaCC"
To run your program, right-click on your Main class and select "Run As... > Java Application"
To give the input to your program, open the Console (Alt+Shift+Q C) Type in your input (or copy paste from the provided program.input file) and hit Ctrl+Z to enter an EOF (end-of-file) character. Once you type the EOF, the program will process the input.
You could (should) modify the Main class to create a FileInputStream to read an input file
Here's the DemFGen argument description(s). This is printed whenever you run DemFGen without arguments or if you pass "--help"+------------------------------+ | DemFGen Java | | 10/11/2008 | +------------------------------+ Usage: DemFGen [Options] <CD-File> <BEH-File> <Output-Dir> The order/placement of options doesn't matter, but the relative order of the manditory ones must be as shown. CD-File contains the CD to be generated, BEH-File contains the behavior to be used with classes, Output-Dir is the directory to place generated files Options can be: --help : Print this usage information. --build : Run JavaCC & JavaC after generating the files --lib:FILE : Implies --build, Create a library named FILE from the compiled/generated code (JAR for Java, DLL for C#) --windows : Use Windows based command launches and CSC to compile C# instead of GMCS. System PATH and CLASSPATH variables need to be set correctly. Works with both '--build' and '--lib' --noparse : Don't generate the parser files or methods --mutable : Generate 'mutable' fields... not final/readonly --graph : Just print a Dot file to StdOut --dgp:C1:...:Cn : A Colon seperated List of Data-generic function classes to be run/generated. Each class must be a subclass of edu.neu.ccs.demeterf.demfgen.dgp.DGPFunc and accessible in the current classpath. * Predefined classes are Print, Display, and ToStr, which generate print(), display(), and toStr() methods respectively. Any/all may be used together. * Each one includes a separate Class that generates the same functionality in a toString method. Those classes are named PrintToString, DisplayToString, and ToString. Obviously, only one may be used. * See the demfgen.dgp package source for more details.