Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
D7050E
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aron Strandberg
D7050E
Commits
c2bd9f08
Commit
c2bd9f08
authored
5 years ago
by
Aron Strandberg
Browse files
Options
Downloads
Patches
Plain Diff
added EBNF
parent
36a86377
No related branches found
No related tags found
No related merge requests found
Pipeline
#171
canceled
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
HOME_EXAM.md
+126
-6
126 additions, 6 deletions
HOME_EXAM.md
with
126 additions
and
6 deletions
HOME_EXAM.md
+
126
−
6
View file @
c2bd9f08
# Home Exam D7050E
-
Fork this repo and put your answers (or links to answers) in THIS file.
-
[
Your repo
](
#your-repo
)
-
[
Your syntax
](
#your-syntax
)
-
[
Your semantics
](
#your-semantics
)
-
[
Your type checker
](
#your-type-checker
)
-
[
Your borrrow checker
](
#your-borrrow-checker
)
-
[
Your LLVM backend
](
#your-llvm-backend
)
-
[
Overal course goals and learning outcomes.
](
#overal-course-goals-and-learning-outcomes
)
## Your repo
...
...
@@ -16,9 +20,125 @@
-
Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
Program
```
ebnf
: FunctionDec+
;
```
FunctionDec
```
ebnf
: "fn" Id "(" [ "," ], Params ")" "->" Type "{" Statement "}"
| "fn" Id "(" [ "," ], Params ")" "{" Statement "}"
;
```
Params
```
ebnf
: "Id" ":" Type
;
```
Statement
```
ebnf
: "let" Id ":" Type AssignOp Expr ";"
| "if" Log "{" Statement "}"
| "while" Log "{" Statement "}"
| "return" Expr ";"
| Expr ";"
;
```
LogOp
```
ebnf
: "&&"
| "||"
| "!"
;
```
CondOp
```
ebnf
: ">"
| "<"
| "=="
| "!="
;
```
AssignOp
```
ebnf
: "="
| "+="
| "-="
| "/="
| "*="
;
```
SumOp
```
ebnf
: "+"
| "-"
;
```
FactorOp
```
ebnf
: "*"
| "/"
;
```
Type
```
ebnf
: "i32"
| "bool"
;
```
Term
```
ebnf
: Num
| Id
| Bool
| Function
| "(" Expr ")"
;
```
Num
```
ebnf
: [ "-" ], Digit
;
```
Id
```
ebnf
: Letter , { Letter | Digit }, - White_space
```
Bool
```
ebnf
: "true"
| "false"
;
```
Function
```
ebnf
: Id "(" [ "," ], Expr ")"
;
```
Letter
```
ebnf
: "A" | "B" | "C" | "D" | "E" | "F" | "G"
| "H" | "I" | "J" | "K" | "L" | "M" | "N"
| "O" | "P" | "Q" | "R" | "S" | "T" | "U"
| "V" | "W" | "X" | "Y" | "Z" | "a" | "b"
| "c" | "d" | "e" | "f" | "g" | "h" | "i"
| "j" | "k" | "l" | "m" | "n" | "o" | "p"
| "q" | "r" | "s" | "t" | "u" | "v" | "w"
| "x" | "y" | "z"
;
```
Digit
```
ebnf
: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
;
```
White_space
```
ebnf
: ? White_space characters ?
;
```
## Your semantics
-
Give an as complete as possible Structural Operetional Semantics (SOS) for your language
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment