feat: support variable declaration statement

This commit is contained in:
Lucàs
2024-07-03 00:18:17 +02:00
parent 69e88fd5fd
commit 9d3fa71e34
6 changed files with 131 additions and 4 deletions
+15 -1
View File
@@ -1,5 +1,13 @@
(* lib/ast/syntax.ml *)
type _type =
| Type_Integer
| Type_Float
| Type_Character
| Type_String
| Type_Boolean
| Type_Void
type literal =
| Integer of int
| Float of float
@@ -30,5 +38,11 @@ type expression =
| UnaryExpression of unary_operator * expression
| BinaryExpression of binary_operator * expression * expression
type statement = ExpressionStatement of expression
type variable_declaration =
| VariableDeclaration of _type * expression * expression
type statement =
| ExpressionStatement of expression
| VariableStatement of variable_declaration list
type source_file = SourceFile of statement list