diff options
author | Chimrod <> | 2023-10-06 08:35:56 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-06 08:35:56 +0200 |
commit | 97ab5c9a21166f0bffee482210d69877fd6809fa (patch) | |
tree | d1fa44000fa07631edc8924a90020f2cfe637263 /syntax/S.ml | |
parent | 40f4dbe7844725e0ab07f03f25c35f55b4699b46 (diff) |
Moved qparser and syntax in the library folder
Diffstat (limited to 'syntax/S.ml')
-rw-r--r-- | syntax/S.ml | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/syntax/S.ml b/syntax/S.ml deleted file mode 100644 index 3873eed..0000000 --- a/syntax/S.ml +++ /dev/null @@ -1,91 +0,0 @@ -(** - This module describe the type an analyzer must implement in order to be - used with the parser. - - The module is divided in three modules : - - Expression : the finest part of the QSP syntax. - - Instruction : if/act block, - - Location - - All the elements of the syntax are represented with a dedicated function - (instead of a big sum type). The module [Tree] provide an implementation - which build the AST. - - *) - -type pos = Lexing.position * Lexing.position -type ('a, 'b) variable = { pos : 'a; name : string; index : 'b option } - -(** Represent the evaluation over an expression *) -module type Expression = sig - type 'a obs - type repr - - 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]. - *) - - val ident : variable -> repr - - (* - Basic values, text, number… - *) - - val integer : pos -> string -> repr - val literal : pos -> string -> repr - - val function_ : pos -> T.function_ -> repr list -> repr - (** Call a function. The functions list is hardcoded in lib/lexer.mll *) - - val uoperator : pos -> T.uoperator -> repr -> repr - (** Unary operator like [-123] or [+'Text']*) - - val boperator : pos -> T.boperator -> repr -> repr -> repr - (** Binary operator, for a comparaison, or an operation *) -end - -module type Instruction = sig - type repr - type expression - type variable - - val call : pos -> string -> expression list -> repr - (** Call for an instruction like [GT] or [*CLR] *) - - val location : pos -> string -> repr - (** Label for a loop *) - - val comment : pos -> repr - (** Comment *) - - val expression : expression -> repr - (** Raw expression *) - - type clause = pos * expression * repr list - - val if_ : pos -> clause -> elifs:clause list -> else_:repr list -> repr - val act : pos -> label:expression -> repr list -> repr - val assign : pos -> variable -> T.assignation_operator -> expression -> repr -end - -module type Location = sig - type repr - type instruction - - val location : pos -> instruction list -> repr -end - -module type Analyzer = sig - module Expression : Expression - - module Instruction : - Instruction - with type expression = Expression.repr - and type variable = Expression.variable - - module Location : Location with type instruction = Instruction.repr -end |