mirror of
https://github.com/LucasVbr/croissant.git
synced 2026-05-14 01:22:06 +00:00
feat: Add Literals and operator of comparison
This commit is contained in:
+26
-4
@@ -1,12 +1,34 @@
|
||||
(* lib/ast/syntax.ml *)
|
||||
|
||||
type binary_operator = Add | Substract | Multiply | Divide
|
||||
type unary_operator = Negate
|
||||
type literal =
|
||||
| Integer of int
|
||||
| Float of float
|
||||
| Character of char
|
||||
| String of string
|
||||
| Boolean of bool
|
||||
| Null
|
||||
|
||||
type binary_operator =
|
||||
| Add
|
||||
| Substract
|
||||
| Multiply
|
||||
| Divide
|
||||
| AmpersandAmpersand
|
||||
| BarBar
|
||||
| EqualsEquals
|
||||
| ExclamationEquals
|
||||
| LessThan
|
||||
| LessThanEquals
|
||||
| GreaterThan
|
||||
| GreaterThanEquals
|
||||
|
||||
type unary_operator = Negate | Not
|
||||
|
||||
type expression =
|
||||
| IntegerLiteral of int
|
||||
| Literal of literal
|
||||
| Identifier of string
|
||||
| UnaryExpression of unary_operator * expression
|
||||
| BinaryExpression of binary_operator * expression * expression
|
||||
|
||||
type statement = ExpressionStatement of expression
|
||||
type source_file = SourceFile of statement list
|
||||
type source_file = SourceFile of statement list
|
||||
Reference in New Issue
Block a user