diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..3834218 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "mnxn.fsharp-fsl-fsy", + "ionide.ionide-fsharp" + ] +} diff --git a/Graph.fs b/Graph.fs index 3fe511e..4be692b 100644 --- a/Graph.fs +++ b/Graph.fs @@ -12,6 +12,5 @@ type Input = { determinism: Determinism } type Output = { dot: string } -// Start you implementation here let analysis (src: string) (input: Input) : Output = - failwith "Graph analysis not yet implemented" + failwith "Graph analysis not yet implemented" // TODO: start here diff --git a/Interpreter.fs b/Interpreter.fs index 99a6330..f14bfe2 100644 --- a/Interpreter.fs +++ b/Interpreter.fs @@ -28,6 +28,5 @@ type ProgramTrace = type Output = List -// Start you implementation here let analysis (src: string) (input: Input) : Output = - failwith "Interpreter not yet implemented" + failwith "Interpreter not yet implemented" // TODO: start here diff --git a/Program.fs b/Program.fs index 865cb71..1f730fb 100644 --- a/Program.fs +++ b/Program.fs @@ -1,4 +1,4 @@ -open FSharp.Text.Lexing +open FSharp.Text.Lexing open System open Newtonsoft.Json open AST @@ -48,6 +48,11 @@ let main (args) = Console.WriteLine("{0}", evaluate ast) | Error e -> Console.Error.WriteLine("Parse error: {0}", e) + 0 + | [ "parse"; src ] -> + let output:string = Parse.analysis src + Console.WriteLine("{0}", output) + 0 | [ "graph"; src; input ] -> let input = JsonConvert.DeserializeObject input @@ -82,6 +87,7 @@ let main (args) = | _ -> let commands = [ "calc " + "parse " "graph " "interpreter " "pv " diff --git a/ProgramVerification.fs b/ProgramVerification.fs index a84e3b3..9b8330f 100644 --- a/ProgramVerification.fs +++ b/ProgramVerification.fs @@ -10,6 +10,5 @@ type Input = { post_condition: string } type Output = { pre_condition: string } -// Start you implementation here let analysis (src: string) (input: Input) : Output = - failwith "Program verification analysis not yet implemented" + failwith "Program verification analysis not yet implemented" // TODO: start here diff --git a/README.md b/README.md index 0efff5f..ce4ed22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # F# Starter -This folder contains the skeleton of a parser along with the input and output types for each analysis given in the assignment. It also contain an example of a "calculator" program in F# that reads an arithmetic expression from the command line and print the result of evaluating such expression for initial testing. +This folder contains the skeleton of a parser along with the input and output types for each analysis given in the assignment. It also contains an example of a "calculator" program in F# that reads an arithmetic expression from the command line and print the result of evaluating such expression for initial testing. ## Files @@ -9,7 +9,7 @@ F#/FsLexYacc * [Parser.fsp](Parser.fsp): The parser for arithmetic expressions * [Types.fs](Types.fs): Global types that are used in many analysis * [AST.fs](AST.fs): Types for AST of arithmetic expressions -* [Program.fs](Program.fs): The entrypoint for the program +* [Program.fs](Program.fs): The entry point for the program * [Security.fs](Security.fs): File for the security analysis * [SignAnalysis.fs](SignAnalysis.fs): File for the sign analysis * [ProgramVerification.fs](ProgramVerification.fs): File for program verification @@ -19,16 +19,19 @@ F#/FsLexYacc ## Getting started -Building this project requires .NET 7.0. Installation +Building this project requires .NET 7.0. For installation, follow the description matching your platform: - **Windows:** Installation instructions for this, can be found [here](https://dotnet.microsoft.com/en-us/download). - **macOS:** Building on macOS requires the `dotnet-sdk` package. This can be installed using [Homebrew](https://brew.sh) and running `brew install dotnet-sdk` - **Linux:** There are many ways to install on Linux, but a good starting point might be [this](https://fsharp.org/use/linux/). +To check that you have an up-to-date version run `dotnet --version` to display the version number, which should be something starting with 7. If it does not, consider updating your installation, and if that doesn't work, try uninstalling your current version and installing from scratch. + +The next step is getting the code, which is done by cloning this repository and using `cd` to change directory to the newly cloned folder. To do this, make sure that you have your SSH keys set up correctly (instructions for [GitLab](https://docs.gitlab.com/ee/user/ssh.html)). ## Running the code -To run the program do: +To run the program, navigate to the directory of your cloned repository and do: ```bash dotnet run @@ -44,7 +47,7 @@ dotnet run calc "1 + 52 * 23" ## Interactive UI -When you get further, the analysis can be explored in the interactive tool. Run the program in `dev/` folder matching you operating system. +When you get further, the analysis can be explored in the interactive tool. Run the program in the `dev/` folder matching your operating system. ```bash # Windows @@ -78,6 +81,6 @@ It is recommended to update the binaries in `dev/` regularly. You do this by run ## Evaluation -Every time you push to git, the program is ready to be evaluated automatically by your teachers. +Every time you push your Git repository, your code is ready to be evaluated automatically by your teachers. -The results as they are produced, can be seen (at GitLab) in the `result` branch. +When your project has been evaluated, the results can be seen (at GitLab) in the "result" branch. diff --git a/Security.fs b/Security.fs index 38388d8..dfb0b0f 100644 --- a/Security.fs +++ b/Security.fs @@ -23,6 +23,5 @@ type Output = violations: Flow list } -// "Start you implementation here" let analysis (src: string) (input: Input) : Output = - failwith "Security analysis not yet implemented" + failwith "Security analysis not yet implemented" // TODO: start here diff --git a/SignAnalysis.fs b/SignAnalysis.fs index 444d1dd..863ced2 100644 --- a/SignAnalysis.fs +++ b/SignAnalysis.fs @@ -27,6 +27,5 @@ type Output = nodes: Map> } -// Start you implementation here let analysis (src: string) (input: Input) : Output = - failwith "Sign analysis not yet implemented" + failwith "Sign analysis not yet implemented" // TODO: start here