diff options
author | Chimrod <> | 2023-10-06 08:37:23 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-15 19:04:36 +0200 |
commit | 8ec89159f83b2c65995555f2c1a65e8ded950242 (patch) | |
tree | b4eaed9d909a813862496f819a56c52f99d763cb | |
parent | a7e382aa2b31a4ec044bda12155818c22b33d989 (diff) |
Added default syntax implementation
-rw-r--r-- | lib/syntax/default.ml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/syntax/default.ml b/lib/syntax/default.ml new file mode 100644 index 0000000..f4bc34e --- /dev/null +++ b/lib/syntax/default.ml @@ -0,0 +1,33 @@ +type pos = Lexing.position * Lexing.position +type ('a, 'b) variable = { pos : 'a; name : string; index : 'b option } + +module Expression = struct + type 'a obs + type repr = unit + + type variable = { pos : pos; name : string; index : repr option } + (** + Describe a variable, using the name in capitalized text, and an optionnal + index. + + If missing, the index should be considered as [0]. + *) + + let ident : variable -> repr = fun _ -> () + + (* + Basic values, text, number… + *) + + let integer : pos -> string -> repr = fun _ _ -> () + let literal : pos -> string -> repr = fun _ _ -> () + + (** Call a function. The functions list is hardcoded in lib/lexer.mll *) + let function_ : pos -> T.function_ -> repr list -> repr = fun _ _ _ -> () + + (** Unary operator like [-123] or [+'Text']*) + let uoperator : pos -> T.uoperator -> repr -> repr = fun _ _ _ -> () + + (** Binary operator, for a comparaison, or an operation *) + let boperator : pos -> T.boperator -> repr -> repr -> repr = fun _ _ _ _ -> () +end |