Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tddd55-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TDDD55 - Compilers and Interpreters
tddd55-lab
Commits
3ef96230
Commit
3ef96230
authored
1 year ago
by
johti17
Browse files
Options
Downloads
Patches
Plain Diff
Added another file the student can run the diff against
parent
ae8be18b
No related branches found
No related tags found
1 merge request
!5
Feedback 2023
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lab3-4/README.md
+43
-0
43 additions, 0 deletions
lab3-4/README.md
traces/trace_expression_test.txt
+208
-0
208 additions, 0 deletions
traces/trace_expression_test.txt
with
251 additions
and
0 deletions
lab3-4/README.md
0 → 100644
+
43
−
0
View file @
3ef96230
# Code Skeleton for Lab 3 and Lab 4
This folder contains the code skeleton that you will be working on during Lab 3 and Lab 4.
## Lab 3
For Lab 3 two files are of interest,
`parser.y`
and
`scanner.l`
.
To start, begin by integrating what you did in lab 1 to the
`scanner.l`
file.
Here it is important that you are careful, and that you do not simply copy paste.
Look at the structure of
`scanner.l`
and enter your rules s.t you do not remove any includes present in that file.
### Testing Lab 3.
There is a number of test files in the
`test`
directory that you may use to check if your parser works as expected.
We also provide traces that you can use to compare the output of your solution to some expected output.
To do this you can exceute the following sequence of commands.
To check if you get about the same result for expressions you can run:
```
bash
./compiler ./test/expression_test.prog
>
my_output.txt
diff
-y
my_output.txt ../traces/trace_expression_test.txt
```
The same procedure can be done for the more advanced test, that is
`traces/trace-lab3.txt`
```
./compiler ./test/test > my_output.txt
diff -y my_output.txt ../traces/trace-lab3.txt
```
## Lab 4
In lab 4 you will work in file
`codegen.cc`
search for
`/* --- Your code here --- */`
'
to see where you need to introduce your changes.
### Testing Lab 4
In order to test Lab 4, there exists a test script.
For more details see the README in the test folder.
## Other notes
For more exhaustive documentation see
[
The Lab Skeleton Documentation
](
https://www.ida.liu.se/~TDDD55/laboratories/instructions/_static/skeleton.pdf
)
This diff is collapsed.
Click to expand it.
traces/trace_expression_test.txt
0 → 100644
+
208
−
0
View file @
3ef96230
FunctionInformation @ 0x564ef0e59ed0
Tag: 0
ID: main
Table: 0
Parent: 0
Returns: 0
Parameters: none
Locals:
0x564ef0e6c9d0 b
0x564ef0e6c8c0 a
Body: 0x564ef0e6e780
StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putreal
| +-ExpressionList (expression, preceding)
| +-Identifier (b)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (b)
| +-Power (left, right) [real]
| +-RealConstant (2) [real]
| +-RealConstant (2) [real]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putreal
| +-ExpressionList (expression, preceding)
| +-Identifier (b)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (b)
| +-Divide (left, right) [real]
| +-RealConstant (2) [real]
| +-RealConstant (2) [real]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putreal
| +-ExpressionList (expression, preceding)
| +-Identifier (b)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (b)
| +-Times (left, right) [real]
| +-RealConstant (2) [real]
| +-RealConstant (2) [real]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putreal
| +-ExpressionList (expression, preceding)
| +-Identifier (b)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (b)
| +-Minus (left, right) [real]
| +-RealConstant (2) [real]
| +-RealConstant (2) [real]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putreal
| +-ExpressionList (expression, preceding)
| +-Identifier (b)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (b)
| +-Plus (left, right) [real]
| +-RealConstant (1) [real]
| +-RealConstant (2) [real]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putint
| +-ExpressionList (expression, preceding)
| +-Identifier (a)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (a)
| +-Power (left, right) [integer]
| +-IntegerConstant (2) [integer]
| +-IntegerConstant (2) [integer]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putint
| +-ExpressionList (expression, preceding)
| +-Identifier (a)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (a)
| +-Divide (left, right) [integer]
| +-IntegerConstant (2) [integer]
| +-IntegerConstant (2) [integer]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putint
| +-ExpressionList (expression, preceding)
| +-Identifier (a)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (a)
| +-Times (left, right) [integer]
| +-IntegerConstant (2) [integer]
| +-IntegerConstant (2) [integer]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putint
| +-ExpressionList (expression, preceding)
| +-Identifier (a)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (a)
| +-Minus (left, right) [integer]
| +-IntegerConstant (2) [integer]
| +-IntegerConstant (2) [integer]
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [<SymbolInformation @ 0x0>]
| +-putline
| +-0
+-StatementList (statement, preceding)
+-CallStatement (call)
| +-FunctionCall (function, arguments) [integer]
| +-putint
| +-ExpressionList (expression, preceding)
| +-Identifier (a)
| +-0
+-StatementList (statement, preceding)
+-Assignment (left, right)
| +-Identifier (a)
| +-Plus (left, right) [integer]
| +-IntegerConstant (1) [integer]
| +-IntegerConstant (2) [integer]
+-0
Quads: 0
-------------------------------------------------------------------------------
SymbolTable @ 0x564ef0e59f28
-------------------------------------------------------------------------------
11 0x564ef0e64320 getint() -> integer
65 0x564ef0e6c8c0 a : 0x564ef0e5bf80 integer [8]
66 0x564ef0e6c9d0 b : 0x564ef0e5bff0 real [8] --> 0x564ef0e6c8c0 a
88 0x564ef0e5bf80 0x564ef0e5bf80 integer [8]
92 0x564ef0e5c060 putreal(x) -> integer
481 0x564ef0e5e110 putline() -> no return type
603 0x564ef0e5bff0 0x564ef0e5bff0 real [8]
775 0x564ef0e601c0 putint(x) -> integer
918 0x564ef0e62270 getreal() -> real
-------------------------------------------------------------------------------
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