Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9c93709
Showing
19 changed files
with
1,404 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="lib" path="antlr-3.3-complete.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>SELMA</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//Comment Testen | ||
/* dit is | ||
een comment | ||
met meerdere | ||
regels | ||
*/ | ||
begin //start program | ||
2*3; | ||
//compound expression | ||
var i: integer; //single var int decaration | ||
|
||
5*8; | ||
2*3*4; | ||
5*i; | ||
5>=6; | ||
if true; then 5; fi; | ||
if false; then 8; else 3; fi; | ||
i := i := 5; //single assignment | ||
print(i); //single print | ||
var x,y: boolean; //double var bool declaration | ||
var j: integer; //single var int declaration | ||
j := i := j := 7; //double int assignment | ||
print(i,j); //double print | ||
const a: character = 'g'; //single const declaration | ||
//const b: integer = 'l'; //single const declaration | ||
const c: integer = 1; //single const declaration | ||
j := i := 5*c; //double assignment & arith | ||
j := i := 5;//true; | ||
j := j := i; | ||
print(i,j,c); //triple print | ||
end. //end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//SELMA string template | ||
|
||
group SELMA; | ||
|
||
program(instructions) ::= << | ||
; TAM assembler code generated by SELMACompiler | ||
; comments at 50 whitespaces | ||
; start of program | ||
<instructions> | ||
HALT ; end of program | ||
>> | ||
|
||
compound(instructions) ::= << | ||
; start compound | ||
<instructions; separator="\n"> | ||
; end compound | ||
>> | ||
|
||
|
||
//Calculations | ||
Expr(e1,op)::=<< | ||
<e1> ; e1 for operation <op> | ||
CALL <op> ; operation <op> | ||
>> | ||
|
||
biExpr(e1,e2,op)::=<< | ||
<e1> ; e1 for operation <op> | ||
<e2> ; e2 for operation <op> | ||
CALL <op> ; operation <op> | ||
>> | ||
|
||
//Declare | ||
declareConst(id,val,type,addr)::=<< | ||
LOADL <val> ; declare var <id>: <type> = <val> @ <addr>[SB] | ||
>> | ||
|
||
declareVar(id,type,addr)::=<< | ||
PUSH 1 ; declare var <id>: <type> @ <addr>[SB] | ||
>> | ||
|
||
//Load | ||
loadNum(val)::=<< | ||
LOADL <val> ; loadNum <val> | ||
>> | ||
|
||
loadVal(id,addr)::=<< | ||
LOAD(1) <addr>[SB] ; loadVal <id> from <addr>[SB] | ||
>> | ||
|
||
//Assign | ||
assign(id,type,addr,e1)::=<< | ||
<e1> ; e1 right hand for assignment | ||
STORE(1) <addr>[SB] ; assign e1 to <id>: <type> @ <addr>[SB] | ||
>> | ||
|
||
//conditionals | ||
if(ec1,ec2,ec3)::=<< | ||
<ec1> ; e1 right hand for assignment | ||
<ec2> ; e2 right hand for assignment | ||
<ec3> ; e3 right hand for assignment | ||
hier hoort een if | ||
>> | ||
|
||
while(ec1,ec2)::=<< | ||
//<ec1> ; e1 right hand for assignment | ||
//<ec2> ; e2 right hand for assignment | ||
//hier hoort een while | ||
>> |
Oops, something went wrong.