From 8ec89159f83b2c65995555f2c1a65e8ded950242 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Fri, 6 Oct 2023 08:37:23 +0200 Subject: Added default syntax implementation --- lib/syntax/default.ml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/syntax/default.ml (limited to 'lib') 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 -- cgit v1.2.3