-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
ef31143
commit 289ffe2
Showing
1 changed file
with
36 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,36 @@ | ||
|
||
getType :: Type -> String | ||
getType Int32 = "Int32" | ||
getType _ = Nothing | ||
|
||
type Type = String | ||
|
||
type TypeValue = Int32 | Bool | String | ||
|
||
data Value = Var String | StaticValue TypeValue | Function FuncCall | ||
|
||
|
||
-- Function | ||
|
||
type Var = (Symbol, Type) | ||
|
||
type ReturnType = Type | Void | ||
|
||
type FuncPrototype = (Symbol, [Var], ReturnType) | ||
|
||
type FuncDeclaration = (FuncPrototype, [Instruction]) | ||
|
||
|
||
-- condition | ||
|
||
type Condition = (Value, [Instruction], [Instruction]) | ||
|
||
-- Instruction | ||
|
||
type FuncCall = (Symbol, [Value]) | ||
|
||
type VarDeclaration = (Var, Value) | ||
|
||
type VarAssignation = (Symbol, Value) | ||
|
||
data Instruction = Function FuncCall | Return Value | Declaration VarDeclaration | Assignation VarAssignation | Cond Condition |