To down load this project, follow these steps:
- Open a command promt
- Navigate to where you want to put the project
- Execute the following command:
git clone [email protected]:JoeInator/ComputerScienceModeling.git - Type
cd ComputerScienceModeling
To execute this project, you'll have to generate the lexer and the parser using the following commands:
FsLexYacc.10.0.0/build/fslex/net46/fslex.exe CalculatorLexer.fsl --unicode
FsLexYacc.10.0.0/build/fsyacc/net46/fsyacc.exe CalculatorParser.fsp --module CalculatorParser
That will generate the three files CalculatorLexer.fs, CalculatorParser.fs and CalculatorParser.fsi which are crucial for the progam to execute.
Lastly, run the following command to start the program
fsi Calculator.fsx
You can all the relevant commands for generating the parser and starting the program by typing ./run.sh in the terminal
For this this assignment, two new files has been added to the project:
- ProgramGraph.fsx - This file takes the input evaluated by the parser, and turns it into an array of edges by implementing the edges function from the book "formal methods"
- PopulateFile.fsx - This file takes the output array from ProgramGraph.fsx and uses it to write a graphviz file that can vusialize the program graph
- The matching type problem need to be fixed - This has been sorted out by turning everything into a string. I am not convinced that this is a good way to go tho.
- We haven't implemented two different PG's for the graphviz file. At the moment, only non-deterministic PG's can be printed into the graphviz file
- multigauded commands for loops e.g. do..od crashes the program in the PG generations with the DONE[GC] as we haven't been able to porperly implement it. Yet
For this assignment, there 4 important files.
CalculatorParser.fswhich handles the input based on defined patterns with the specified tokensCalculatorLexer.fswhich matches the input keywords and special characters to a specified tokenCalculatorTypesAST.fswhich contains the abstract syntax that are assigned the appropiate pattern inCalculatorParser.fsCalculator.fsxwhich reads the given input, and initiates the parser and the lexer to evaluate it.