Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"mnxn.fsharp-fsl-fsy",
"ionide.ionide-fsharp"
]
}
3 changes: 1 addition & 2 deletions Graph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions Interpreter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ type ProgramTrace =

type Output = List<ProgramTrace>

// Start you implementation here
let analysis (src: string) (input: Input) : Output =
failwith "Interpreter not yet implemented"
failwith "Interpreter not yet implemented" // TODO: start here
8 changes: 7 additions & 1 deletion Program.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open FSharp.Text.Lexing
open FSharp.Text.Lexing
open System
open Newtonsoft.Json
open AST
Expand Down Expand Up @@ -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<Graph.Input> input
Expand Down Expand Up @@ -82,6 +87,7 @@ let main (args) =
| _ ->
let commands =
[ "calc <EXPRESSION...>"
"parse <SRC>"
"graph <SRC> <INPUT>"
"interpreter <SRC> <INPUT>"
"pv <SRC> <INPUT>"
Expand Down
3 changes: 1 addition & 2 deletions ProgramVerification.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
3 changes: 1 addition & 2 deletions Security.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions SignAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ type Output =
nodes: Map<string, Set<SignAssignment>> }


// 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