From be563a24f63758ad00dd2f369fc066916cfb0244 Mon Sep 17 00:00:00 2001 From: Denis Merigoux Date: Wed, 9 Dec 2020 14:51:22 +0100 Subject: [PATCH] Defined operators for dec and money --- Makefile | 3 +- src/catala/catala_surface/ast.ml | 18 +- src/catala/catala_surface/desugaring.ml | 36 +- src/catala/catala_surface/lexer.ml | 82 +++- src/catala/catala_surface/lexer_en.ml | 82 +++- src/catala/catala_surface/lexer_fr.ml | 82 +++- src/catala/catala_surface/name_resolution.ml | 13 +- src/catala/catala_surface/parser.messages | 472 +++++++++---------- src/catala/catala_surface/parser.mly | 49 +- src/catala/catala_surface/parser_errors.ml | 232 ++++----- src/catala/default_calculus/ast.ml | 27 +- src/catala/default_calculus/interpreter.ml | 41 +- src/catala/default_calculus/print.ml | 28 +- src/catala/default_calculus/typing.ml | 76 +-- src/catala/scope_language/ast.ml | 5 +- src/catala/scope_language/dependency.ml | 2 +- src/catala/scope_language/print.ml | 9 +- src/catala/scope_language/scope_to_dcalc.ml | 13 +- tests/test_dec/simple.catala | 2 +- 19 files changed, 733 insertions(+), 539 deletions(-) diff --git a/Makefile b/Makefile index 8a2297cd..9e784a0a 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,11 @@ install-dependencies-ocaml: menhirLib \ dune dune-build-info \ cmdliner obelisk \ - re reason \ + re \ obelisk \ unionfind \ bindlib \ + zarith \ ocamlgraph init-submodules: diff --git a/src/catala/catala_surface/ast.ml b/src/catala/catala_surface/ast.ml index 9b078376..4df599f8 100644 --- a/src/catala/catala_surface/ast.ml +++ b/src/catala/catala_surface/ast.ml @@ -55,9 +55,23 @@ type enum_decl = { type match_case_pattern = constructor Pos.marked list * ident Pos.marked option -type binop = And | Or | Add | Sub | Mult | Div | Lt | Lte | Gt | Gte | Eq | Neq +type op_kind = KInt | KDec | KMoney -type unop = Not | Minus +type binop = + | And + | Or + | Add of op_kind + | Sub of op_kind + | Mult of op_kind + | Div of op_kind + | Lt of op_kind + | Lte of op_kind + | Gt of op_kind + | Gte of op_kind + | Eq + | Neq + +type unop = Not | Minus of op_kind type builtin_expression = Cardinal | Now diff --git a/src/catala/catala_surface/desugaring.ml b/src/catala/catala_surface/desugaring.ml index 06dc5634..bdff831b 100644 --- a/src/catala/catala_surface/desugaring.ml +++ b/src/catala/catala_surface/desugaring.ml @@ -19,22 +19,26 @@ module Cli = Utils.Cli (** The optional argument subdef allows to choose between differents uids in case the expression is a redefinition of a subvariable *) +let translate_op_kind (k : Ast.op_kind) : Dcalc.Ast.op_kind = + match k with KInt -> KInt | KDec -> KRat | KMoney -> KMoney + let translate_binop (op : Ast.binop) : Dcalc.Ast.binop = match op with | And -> And | Or -> Or - | Add -> Add - | Sub -> Sub - | Mult -> Mult - | Div -> Div - | Lt -> Lt - | Lte -> Lte - | Gt -> Gt - | Gte -> Gte + | Add l -> Add (translate_op_kind l) + | Sub l -> Sub (translate_op_kind l) + | Mult l -> Mult (translate_op_kind l) + | Div l -> Div (translate_op_kind l) + | Lt l -> Lt (translate_op_kind l) + | Lte l -> Lte (translate_op_kind l) + | Gt l -> Gt (translate_op_kind l) + | Gte l -> Gte (translate_op_kind l) | Eq -> Eq | Neq -> Neq -let translate_unop (op : Ast.unop) : Dcalc.Ast.unop = match op with Not -> Not | Minus -> Minus +let translate_unop (op : Ast.unop) : Dcalc.Ast.unop = + match op with Not -> Not | Minus l -> Minus (translate_op_kind l) module LiftStructFieldMap = Bindlib.Lift (Scopelang.Ast.StructFieldMap) module LiftEnumConstructorMap = Bindlib.Lift (Scopelang.Ast.EnumConstructorMap) @@ -66,17 +70,9 @@ let rec translate_expr (scope : Scopelang.Ast.ScopeName.t) match l with | Number ((Int i, _), _) -> Scopelang.Ast.ELit (Dcalc.Ast.LInt i) | Number ((Dec (i, f), _), _) -> - let out = - Scopelang.Ast.ELit - (Dcalc.Ast.LRat - Q.( - of_int64 i + (of_int64 f / of_float (10.0 ** ceil (log10 (Int64.to_float f)))))) - in - Cli.debug_print - (Format.asprintf "%d.%d -> %a (%s)" (Int64.to_int i) (Int64.to_int f) - Scopelang.Print.format_expr (out, Pos.no_pos) - (Q.to_string (Q.of_float (ceil (log10 (Int64.to_float f)))))); - out + Scopelang.Ast.ELit + (Dcalc.Ast.LRat + Q.(of_int64 i + (of_int64 f / of_float (10.0 ** ceil (log10 (Int64.to_float f)))))) | Bool b -> Scopelang.Ast.ELit (Dcalc.Ast.LBool b) | _ -> Name_resolution.raise_unsupported_feature "literal" pos in diff --git a/src/catala/catala_surface/lexer.ml b/src/catala/catala_surface/lexer.ml index 4d5ddea2..266a66cf 100644 --- a/src/catala/catala_surface/lexer.ml +++ b/src/catala/catala_surface/lexer.ml @@ -301,9 +301,54 @@ let rec lex_code (lexbuf : lexbuf) : token = | "->" -> update_acc lexbuf; ARROW - | '.' -> + | "<=", 0x24 -> update_acc lexbuf; - DOT + LESSER_EQUAL_MONEY + | '<', 0x24 -> + update_acc lexbuf; + LESSER_MONEY + | ">=", 0x24 -> + update_acc lexbuf; + GREATER_EQUAL_MONEY + | '>', 0x24 -> + update_acc lexbuf; + GREATER_MONEY + | '+', 0x24 -> + update_acc lexbuf; + PLUSMONEY + | '-', 0x24 -> + update_acc lexbuf; + MINUSMONEY + | '*', 0x24 -> + update_acc lexbuf; + MULTMONEY + | '/', 0x24 -> + update_acc lexbuf; + DIVMONEY + | "<=." -> + update_acc lexbuf; + LESSER_EQUAL_DEC + | "<." -> + update_acc lexbuf; + LESSER_DEC + | ">=." -> + update_acc lexbuf; + GREATER_EQUAL_DEC + | ">." -> + update_acc lexbuf; + GREATER_DEC + | "+." -> + update_acc lexbuf; + PLUSDEC + | "-." -> + update_acc lexbuf; + MINUSDEC + | "*." -> + update_acc lexbuf; + MULTDEC + | "/." -> + update_acc lexbuf; + DIVDEC | "<=" -> update_acc lexbuf; LESSER_EQUAL @@ -316,12 +361,27 @@ let rec lex_code (lexbuf : lexbuf) : token = | '>' -> update_acc lexbuf; GREATER + | '+' -> + update_acc lexbuf; + PLUS + | '-' -> + update_acc lexbuf; + MINUS + | '*' -> + update_acc lexbuf; + MULT + | '/' -> + update_acc lexbuf; + DIV | "!=" -> update_acc lexbuf; NOT_EQUAL | '=' -> update_acc lexbuf; EQUAL + | '%' -> + update_acc lexbuf; + PERCENT | '(' -> update_acc lexbuf; LPAREN @@ -334,21 +394,6 @@ let rec lex_code (lexbuf : lexbuf) : token = | '}' -> update_acc lexbuf; RBRACKET - | '+' -> - update_acc lexbuf; - PLUS - | '-' -> - update_acc lexbuf; - MINUS - | '*' -> - update_acc lexbuf; - MULT - | '%' -> - update_acc lexbuf; - PERCENT - | '/' -> - update_acc lexbuf; - DIV | '|' -> update_acc lexbuf; VERTICAL @@ -358,6 +403,9 @@ let rec lex_code (lexbuf : lexbuf) : token = | "--" -> update_acc lexbuf; ALT + | '.' -> + update_acc lexbuf; + DOT | uppercase, Star (uppercase | lowercase | '0' .. '9' | '_' | '\'') -> (* Name of constructor *) update_acc lexbuf; diff --git a/src/catala/catala_surface/lexer_en.ml b/src/catala/catala_surface/lexer_en.ml index 56c0012f..c3f57700 100644 --- a/src/catala/catala_surface/lexer_en.ml +++ b/src/catala/catala_surface/lexer_en.ml @@ -269,9 +269,54 @@ let rec lex_code_en (lexbuf : lexbuf) : token = | "->" -> L.update_acc lexbuf; ARROW - | '.' -> + | "<=", 0x24 -> L.update_acc lexbuf; - DOT + LESSER_EQUAL_MONEY + | '<', 0x24 -> + L.update_acc lexbuf; + LESSER_MONEY + | ">=", 0x24 -> + L.update_acc lexbuf; + GREATER_EQUAL_MONEY + | '>', 0x24 -> + L.update_acc lexbuf; + GREATER_MONEY + | '+', 0x24 -> + L.update_acc lexbuf; + PLUSMONEY + | '-', 0x24 -> + L.update_acc lexbuf; + MINUSMONEY + | '*', 0x24 -> + L.update_acc lexbuf; + MULTMONEY + | '/', 0x24 -> + L.update_acc lexbuf; + DIVMONEY + | "<=." -> + L.update_acc lexbuf; + LESSER_EQUAL_DEC + | "<." -> + L.update_acc lexbuf; + LESSER_DEC + | ">=." -> + L.update_acc lexbuf; + GREATER_EQUAL_DEC + | ">." -> + L.update_acc lexbuf; + GREATER_DEC + | "+." -> + L.update_acc lexbuf; + PLUSDEC + | "-." -> + L.update_acc lexbuf; + MINUSDEC + | "*." -> + L.update_acc lexbuf; + MULTDEC + | "/." -> + L.update_acc lexbuf; + DIVDEC | "<=" -> L.update_acc lexbuf; LESSER_EQUAL @@ -284,12 +329,27 @@ let rec lex_code_en (lexbuf : lexbuf) : token = | '>' -> L.update_acc lexbuf; GREATER + | '+' -> + L.update_acc lexbuf; + PLUS + | '-' -> + L.update_acc lexbuf; + MINUS + | '*' -> + L.update_acc lexbuf; + MULT + | '/' -> + L.update_acc lexbuf; + DIV | "!=" -> L.update_acc lexbuf; NOT_EQUAL | '=' -> L.update_acc lexbuf; EQUAL + | '%' -> + L.update_acc lexbuf; + PERCENT | '(' -> L.update_acc lexbuf; LPAREN @@ -302,21 +362,6 @@ let rec lex_code_en (lexbuf : lexbuf) : token = | '}' -> L.update_acc lexbuf; RBRACKET - | '+' -> - L.update_acc lexbuf; - PLUS - | '-' -> - L.update_acc lexbuf; - MINUS - | '*' -> - L.update_acc lexbuf; - MULT - | '%' -> - L.update_acc lexbuf; - PERCENT - | '/' -> - L.update_acc lexbuf; - DIV | '|' -> L.update_acc lexbuf; VERTICAL @@ -326,6 +371,9 @@ let rec lex_code_en (lexbuf : lexbuf) : token = | "--" -> L.update_acc lexbuf; ALT + | '.' -> + L.update_acc lexbuf; + DOT | uppercase, Star (uppercase | lowercase | '0' .. '9' | '_' | '\'') -> (* Name of constructor *) L.update_acc lexbuf; diff --git a/src/catala/catala_surface/lexer_fr.ml b/src/catala/catala_surface/lexer_fr.ml index 7b9c2f62..bb32ccbc 100644 --- a/src/catala/catala_surface/lexer_fr.ml +++ b/src/catala/catala_surface/lexer_fr.ml @@ -278,9 +278,54 @@ let rec lex_code_fr (lexbuf : lexbuf) : token = | "->" -> L.update_acc lexbuf; ARROW - | '.' -> + | "<=", 0x20AC -> L.update_acc lexbuf; - DOT + LESSER_EQUAL_MONEY + | '<', 0x20AC -> + L.update_acc lexbuf; + LESSER_MONEY + | ">=", 0x20AC -> + L.update_acc lexbuf; + GREATER_EQUAL_MONEY + | '>', 0x20AC -> + L.update_acc lexbuf; + GREATER_MONEY + | '+', 0x20AC -> + L.update_acc lexbuf; + PLUSMONEY + | '-', 0x20AC -> + L.update_acc lexbuf; + MINUSMONEY + | '*', 0x20AC -> + L.update_acc lexbuf; + MULTMONEY + | '/', 0x20AC -> + L.update_acc lexbuf; + DIVMONEY + | "<=." -> + L.update_acc lexbuf; + LESSER_EQUAL_DEC + | "<." -> + L.update_acc lexbuf; + LESSER_DEC + | ">=." -> + L.update_acc lexbuf; + GREATER_EQUAL_DEC + | ">." -> + L.update_acc lexbuf; + GREATER_DEC + | "+." -> + L.update_acc lexbuf; + PLUSDEC + | "-." -> + L.update_acc lexbuf; + MINUSDEC + | "*." -> + L.update_acc lexbuf; + MULTDEC + | "/." -> + L.update_acc lexbuf; + DIVDEC | "<=" -> L.update_acc lexbuf; LESSER_EQUAL @@ -293,12 +338,27 @@ let rec lex_code_fr (lexbuf : lexbuf) : token = | '>' -> L.update_acc lexbuf; GREATER + | '+' -> + L.update_acc lexbuf; + PLUS + | '-' -> + L.update_acc lexbuf; + MINUS + | '*' -> + L.update_acc lexbuf; + MULT + | '/' -> + L.update_acc lexbuf; + DIV | "!=" -> L.update_acc lexbuf; NOT_EQUAL | '=' -> L.update_acc lexbuf; EQUAL + | '%' -> + L.update_acc lexbuf; + PERCENT | '(' -> L.update_acc lexbuf; LPAREN @@ -311,21 +371,6 @@ let rec lex_code_fr (lexbuf : lexbuf) : token = | '}' -> L.update_acc lexbuf; RBRACKET - | '+' -> - L.update_acc lexbuf; - PLUS - | '-' -> - L.update_acc lexbuf; - MINUS - | '*' -> - L.update_acc lexbuf; - MULT - | '%' -> - L.update_acc lexbuf; - PERCENT - | '/' -> - L.update_acc lexbuf; - DIV | '|' -> L.update_acc lexbuf; VERTICAL @@ -335,6 +380,9 @@ let rec lex_code_fr (lexbuf : lexbuf) : token = | "--" -> L.update_acc lexbuf; ALT + | '.' -> + L.update_acc lexbuf; + DOT | uppercase, Star (uppercase | lowercase | '0' .. '9' | '_' | '\'') -> (* Name of constructor *) L.update_acc lexbuf; diff --git a/src/catala/catala_surface/name_resolution.ml b/src/catala/catala_surface/name_resolution.ml index 5daf1316..319d2c48 100644 --- a/src/catala/catala_surface/name_resolution.ml +++ b/src/catala/catala_surface/name_resolution.ml @@ -96,15 +96,16 @@ let process_subscope_decl (scope : Scopelang.Ast.ScopeName.t) (ctxt : context) let process_base_typ (ctxt : context) ((typ, typ_pos) : Ast.base_typ Pos.marked) : Scopelang.Ast.typ Pos.marked = match typ with - | Ast.Condition -> (Scopelang.Ast.TBool, typ_pos) + | Ast.Condition -> (Scopelang.Ast.TLit TBool, typ_pos) | Ast.Data (Ast.Collection _) -> raise_unsupported_feature "collection type" typ_pos | Ast.Data (Ast.Optional _) -> raise_unsupported_feature "option type" typ_pos | Ast.Data (Ast.Primitive prim) -> ( match prim with - | Ast.Integer -> (Scopelang.Ast.TInt, typ_pos) - | Ast.Decimal -> (Scopelang.Ast.TRat, typ_pos) - | Ast.Money | Ast.Date -> raise_unsupported_feature "value type" typ_pos - | Ast.Boolean -> (Scopelang.Ast.TBool, typ_pos) + | Ast.Integer -> (Scopelang.Ast.TLit TInt, typ_pos) + | Ast.Decimal -> (Scopelang.Ast.TLit TRat, typ_pos) + | Ast.Money -> (Scopelang.Ast.TLit TMoney, typ_pos) + | Ast.Date -> raise_unsupported_feature "date type" typ_pos + | Ast.Boolean -> (Scopelang.Ast.TLit TBool, typ_pos) | Ast.Text -> raise_unsupported_feature "text type" typ_pos | Ast.Named ident -> ( match Desugared.Ast.IdentMap.find_opt ident ctxt.struct_idmap with @@ -297,7 +298,7 @@ let process_enum_decl (ctxt : context) (edecl : Ast.enum_decl) : context = (fun cases -> let typ = match cdecl.Ast.enum_decl_case_typ with - | None -> (Scopelang.Ast.TUnit, cdecl_pos) + | None -> (Scopelang.Ast.TLit TUnit, cdecl_pos) | Some typ -> process_type ctxt typ in match cases with diff --git a/src/catala/catala_surface/parser.messages b/src/catala/catala_surface/parser.messages index 68c30541..a3fa6504 100644 --- a/src/catala/catala_surface/parser.messages +++ b/src/catala/catala_surface/parser.messages @@ -1,6 +1,6 @@ source_file_or_master: BEGIN_METADATA BEGIN_CODE END_CODE YEAR ## -## Ends in an error in state: 279. +## Ends in an error in state: 297. ## ## metadata_block -> BEGIN_CODE option(law_text) code END_CODE . option(law_text) END_METADATA [ LAW_TEXT LAW_HEADING LAW_ARTICLE EOF BEGIN_METADATA ] ## @@ -36,7 +36,7 @@ expected a declaration or a scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR CONTENT TEXT YEAR ## -## Ends in an error in state: 273. +## Ends in an error in state: 291. ## ## nonempty_list(enum_decl_line) -> enum_decl_line . [ SCOPE END_CODE DECLARATION ] ## nonempty_list(enum_decl_line) -> enum_decl_line . nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ] @@ -49,7 +49,7 @@ expected another enum case, or a new declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR CONTENT YEAR ## -## Ends in an error in state: 268. +## Ends in an error in state: 286. ## ## enum_decl_line_payload -> CONTENT . typ [ SCOPE END_CODE DECLARATION ALT ] ## @@ -61,7 +61,7 @@ expected a content type source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR YEAR ## -## Ends in an error in state: 267. +## Ends in an error in state: 285. ## ## enum_decl_line -> ALT constructor . option(enum_decl_line_payload) [ SCOPE END_CODE DECLARATION ALT ] ## @@ -73,7 +73,7 @@ expected a payload for your enum case, or another case or declaration source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT YEAR ## -## Ends in an error in state: 266. +## Ends in an error in state: 284. ## ## enum_decl_line -> ALT . constructor option(enum_decl_line_payload) [ SCOPE END_CODE DECLARATION ALT ] ## @@ -85,7 +85,7 @@ expected the name of an enum case source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON YEAR ## -## Ends in an error in state: 265. +## Ends in an error in state: 283. ## ## code_item -> DECLARATION ENUM constructor COLON . nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ] ## @@ -97,7 +97,7 @@ expected an enum case source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM CONSTRUCTOR YEAR ## -## Ends in an error in state: 264. +## Ends in an error in state: 282. ## ## code_item -> DECLARATION ENUM constructor . COLON nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ] ## @@ -109,7 +109,7 @@ expected a colon source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION ENUM YEAR ## -## Ends in an error in state: 263. +## Ends in an error in state: 281. ## ## code_item -> DECLARATION ENUM . constructor COLON nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ] ## @@ -121,7 +121,7 @@ expected the name of your enum source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT CONDITION YEAR ## -## Ends in an error in state: 258. +## Ends in an error in state: 276. ## ## scope_decl_item -> CONTEXT ident CONDITION . option(struct_scope_func) [ SCOPE END_CODE DECLARATION CONTEXT ] ## @@ -133,7 +133,7 @@ expected the next context item or a dependency declaration for this item source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT CONTENT TEXT YEAR ## -## Ends in an error in state: 256. +## Ends in an error in state: 274. ## ## scope_decl_item -> CONTEXT ident CONTENT typ . option(struct_scope_func) [ SCOPE END_CODE DECLARATION CONTEXT ] ## @@ -145,7 +145,7 @@ expected the next context item or a dependency declaration for this item source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT CONTENT YEAR ## -## Ends in an error in state: 255. +## Ends in an error in state: 273. ## ## scope_decl_item -> CONTEXT ident CONTENT . typ option(struct_scope_func) [ SCOPE END_CODE DECLARATION CONTEXT ] ## @@ -157,7 +157,7 @@ expected the type of this context item source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT SCOPE CONSTRUCTOR YEAR ## -## Ends in an error in state: 260. +## Ends in an error in state: 278. ## ## nonempty_list(scope_decl_item) -> scope_decl_item . [ SCOPE END_CODE DECLARATION ] ## nonempty_list(scope_decl_item) -> scope_decl_item . nonempty_list(scope_decl_item) [ SCOPE END_CODE DECLARATION ] @@ -170,7 +170,7 @@ expected the next context item, or another declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT SCOPE YEAR ## -## Ends in an error in state: 253. +## Ends in an error in state: 271. ## ## scope_decl_item -> CONTEXT ident SCOPE . constructor [ SCOPE END_CODE DECLARATION CONTEXT ] ## @@ -182,7 +182,7 @@ expected the name of the subscope for this context item source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT IDENT YEAR ## -## Ends in an error in state: 252. +## Ends in an error in state: 270. ## ## scope_decl_item -> CONTEXT ident . CONTENT typ option(struct_scope_func) [ SCOPE END_CODE DECLARATION CONTEXT ] ## scope_decl_item -> CONTEXT ident . SCOPE constructor [ SCOPE END_CODE DECLARATION CONTEXT ] @@ -196,7 +196,7 @@ expected the kind of this context item: is it a condition, a sub-scope or a data source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON CONTEXT YEAR ## -## Ends in an error in state: 251. +## Ends in an error in state: 269. ## ## scope_decl_item -> CONTEXT . ident CONTENT typ option(struct_scope_func) [ SCOPE END_CODE DECLARATION CONTEXT ] ## scope_decl_item -> CONTEXT . ident SCOPE constructor [ SCOPE END_CODE DECLARATION CONTEXT ] @@ -210,7 +210,7 @@ expected the name of this new context item source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR COLON YEAR ## -## Ends in an error in state: 250. +## Ends in an error in state: 268. ## ## code_item -> DECLARATION SCOPE constructor COLON . nonempty_list(scope_decl_item) [ SCOPE END_CODE DECLARATION ] ## @@ -222,7 +222,7 @@ expected a context item introduced by "context" source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE CONSTRUCTOR YEAR ## -## Ends in an error in state: 249. +## Ends in an error in state: 267. ## ## code_item -> DECLARATION SCOPE constructor . COLON nonempty_list(scope_decl_item) [ SCOPE END_CODE DECLARATION ] ## @@ -234,7 +234,7 @@ expected a colon followed by the list of context items of this scope source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION SCOPE YEAR ## -## Ends in an error in state: 248. +## Ends in an error in state: 266. ## ## code_item -> DECLARATION SCOPE . constructor COLON nonempty_list(scope_decl_item) [ SCOPE END_CODE DECLARATION ] ## @@ -246,7 +246,7 @@ expected the name of the scope you are declaring source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEPENDS COLLECTION YEAR ## -## Ends in an error in state: 235. +## Ends in an error in state: 253. ## ## typ -> collection_marked . typ [ SCOPE END_CODE DEPENDS DECLARATION DATA CONTEXT CONDITION ALT ] ## @@ -258,7 +258,7 @@ expected a new struct data, or another declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEPENDS OPTIONAL YEAR ## -## Ends in an error in state: 232. +## Ends in an error in state: 250. ## ## typ -> optional_marked . typ [ SCOPE END_CODE DEPENDS DECLARATION DATA CONTEXT CONDITION ALT ] ## @@ -270,7 +270,7 @@ expected a new struct data, or another declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEPENDS TEXT YEAR ## -## Ends in an error in state: 243. +## Ends in an error in state: 261. ## ## list(struct_scope) -> struct_scope . list(struct_scope) [ SCOPE END_CODE DECLARATION ] ## @@ -282,7 +282,7 @@ expected a new struct data, or another declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEPENDS YEAR ## -## Ends in an error in state: 239. +## Ends in an error in state: 257. ## ## struct_scope_func -> DEPENDS . typ [ SCOPE END_CODE DECLARATION DATA CONTEXT CONDITION ] ## @@ -294,7 +294,7 @@ expected the type of the parameter of this struct data function source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT YEAR ## -## Ends in an error in state: 238. +## Ends in an error in state: 256. ## ## struct_scope -> struct_scope_base . option(struct_scope_func) [ SCOPE END_CODE DECLARATION DATA CONDITION ] ## @@ -306,7 +306,7 @@ expected a new struct data, or another declaration or scope use source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION YEAR ## -## Ends in an error in state: 245. +## Ends in an error in state: 263. ## ## struct_scope_base -> condition_pos . ident [ SCOPE END_CODE DEPENDS DECLARATION DATA CONDITION ] ## @@ -318,7 +318,7 @@ expected the name of this struct condition source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON DATA IDENT CONTENT YEAR ## -## Ends in an error in state: 221. +## Ends in an error in state: 239. ## ## struct_scope_base -> DATA ident CONTENT . typ [ SCOPE END_CODE DEPENDS DECLARATION DATA CONDITION ] ## @@ -330,7 +330,7 @@ expected the type of this struct data source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON DATA IDENT YEAR ## -## Ends in an error in state: 220. +## Ends in an error in state: 238. ## ## struct_scope_base -> DATA ident . CONTENT typ [ SCOPE END_CODE DEPENDS DECLARATION DATA CONDITION ] ## @@ -342,7 +342,7 @@ expected the type of this struct data, introduced by the content keyword source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON DATA YEAR ## -## Ends in an error in state: 219. +## Ends in an error in state: 237. ## ## struct_scope_base -> DATA . ident CONTENT typ [ SCOPE END_CODE DEPENDS DECLARATION DATA CONDITION ] ## @@ -354,7 +354,7 @@ expected the name of this struct data source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON YEAR ## -## Ends in an error in state: 218. +## Ends in an error in state: 236. ## ## code_item -> DECLARATION STRUCT constructor COLON . list(struct_scope) [ SCOPE END_CODE DECLARATION ] ## @@ -366,7 +366,7 @@ expected struct data or condition source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR YEAR ## -## Ends in an error in state: 217. +## Ends in an error in state: 235. ## ## code_item -> DECLARATION STRUCT constructor . COLON list(struct_scope) [ SCOPE END_CODE DECLARATION ] ## @@ -378,7 +378,7 @@ expected a colon source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION STRUCT YEAR ## -## Ends in an error in state: 216. +## Ends in an error in state: 234. ## ## code_item -> DECLARATION STRUCT . constructor COLON list(struct_scope) [ SCOPE END_CODE DECLARATION ] ## @@ -390,7 +390,7 @@ expected the struct name source_file_or_master: LAW_ARTICLE BEGIN_CODE DECLARATION YEAR ## -## Ends in an error in state: 215. +## Ends in an error in state: 233. ## ## code_item -> DECLARATION . STRUCT constructor COLON list(struct_scope) [ SCOPE END_CODE DECLARATION ] ## code_item -> DECLARATION . SCOPE constructor COLON nonempty_list(scope_decl_item) [ SCOPE END_CODE DECLARATION ] @@ -404,7 +404,7 @@ expected the kind of the declaration (struct, scope or enum) source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION CARDINAL THEN ## -## Ends in an error in state: 212. +## Ends in an error in state: 230. ## ## nonempty_list(scope_item) -> scope_item . [ SCOPE END_CODE DECLARATION ] ## nonempty_list(scope_item) -> scope_item . nonempty_list(scope_item) [ SCOPE END_CODE DECLARATION ] @@ -416,23 +416,23 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 49, spurious reduction of production primitive_expression -> CARDINAL -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression -## In state 209, spurious reduction of production assertion_base -> expression -## In state 210, spurious reduction of production assertion -> option(condition_consequence) assertion_base -## In state 211, spurious reduction of production scope_item -> ASSERTION assertion +## In state 51, spurious reduction of production primitive_expression -> CARDINAL +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression +## In state 227, spurious reduction of production assertion_base -> expression +## In state 228, spurious reduction of production assertion -> option(condition_consequence) assertion_base +## In state 229, spurious reduction of production scope_item -> ASSERTION assertion ## expected a new scope use item source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION FIXED IDENT BY YEAR ## -## Ends in an error in state: 206. +## Ends in an error in state: 224. ## ## assertion -> FIXED qident BY . ident [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -444,7 +444,7 @@ expected the legislative text by which the value of the variable is fixed source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION FIXED IDENT WITH_V ## -## Ends in an error in state: 205. +## Ends in an error in state: 223. ## ## assertion -> FIXED qident . BY ident [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -455,15 +455,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 185, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident -## In state 167, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) +## In state 203, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident +## In state 185, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) ## expected the legislative text by which the value of the variable is fixed source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION FIXED YEAR ## -## Ends in an error in state: 204. +## Ends in an error in state: 222. ## ## assertion -> FIXED . qident BY ident [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -475,7 +475,7 @@ expected the name of the variable that should be fixed source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION UNDER_CONDITION CARDINAL CONSEQUENCE BY ## -## Ends in an error in state: 208. +## Ends in an error in state: 226. ## ## assertion -> option(condition_consequence) . assertion_base [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -487,9 +487,9 @@ expected an expression for this definition under condition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION UNDER_CONDITION CARDINAL THEN ## -## Ends in an error in state: 177. +## Ends in an error in state: 195. ## -## condition_consequence -> condition . CONSEQUENCE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FILLED FALSE EXISTS DEFINED_AS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## condition_consequence -> condition . CONSEQUENCE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FILLED FALSE EXISTS DEFINED_AS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## condition @@ -498,21 +498,21 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 49, spurious reduction of production primitive_expression -> CARDINAL -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression -## In state 170, spurious reduction of production condition -> UNDER_CONDITION expression +## In state 51, spurious reduction of production primitive_expression -> CARDINAL +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression +## In state 188, spurious reduction of production condition -> UNDER_CONDITION expression ## expected a consequence for this definition under condition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION UNDER_CONDITION YEAR ## -## Ends in an error in state: 169. +## Ends in an error in state: 187. ## ## condition -> UNDER_CONDITION . expression [ CONSEQUENCE ] ## @@ -524,7 +524,7 @@ expected an expression for this condition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION VARIES IDENT UNDER_CONDITION ## -## Ends in an error in state: 197. +## Ends in an error in state: 215. ## ## assertion -> VARIES qident . WITH_V base_expression option(variation_type) [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -535,15 +535,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 185, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident -## In state 167, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) +## In state 203, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident +## In state 185, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) ## expected an indication about what this variable varies with source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION VARIES IDENT WITH_V TRUE THEN ## -## Ends in an error in state: 199. +## Ends in an error in state: 217. ## ## assertion -> VARIES qident WITH_V base_expression . option(variation_type) [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -554,15 +554,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression ## expected an indication about the variation sense of the variable, or a new scope item source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION VARIES IDENT WITH_V YEAR ## -## Ends in an error in state: 198. +## Ends in an error in state: 216. ## ## assertion -> VARIES qident WITH_V . base_expression option(variation_type) [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -574,7 +574,7 @@ the variable varies with an expression that was expected here source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION VARIES YEAR ## -## Ends in an error in state: 196. +## Ends in an error in state: 214. ## ## assertion -> VARIES . qident WITH_V base_expression option(variation_type) [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -586,7 +586,7 @@ expecting the name of the varying variable source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON ASSERTION YEAR ## -## Ends in an error in state: 195. +## Ends in an error in state: 213. ## ## scope_item -> ASSERTION . assertion [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -598,7 +598,7 @@ expected an expression that shoud be asserted during execution source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION IDENT DEFINED_AS YEAR ## -## Ends in an error in state: 192. +## Ends in an error in state: 210. ## ## definition -> qident option(definition_parameters) option(condition_consequence) DEFINED_AS . expression [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -610,7 +610,7 @@ expected an expression for the definition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION IDENT OF IDENT DECREASING ## -## Ends in an error in state: 190. +## Ends in an error in state: 208. ## ## definition -> qident option(definition_parameters) . option(condition_consequence) DEFINED_AS expression [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -622,7 +622,7 @@ expected a expression for defining this function, introduced by the defined as k source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION IDENT UNDER_CONDITION CARDINAL CONSEQUENCE DECREASING ## -## Ends in an error in state: 191. +## Ends in an error in state: 209. ## ## definition -> qident option(definition_parameters) option(condition_consequence) . DEFINED_AS expression [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -634,7 +634,7 @@ expected an expression for the consequence of this definition under condition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION IDENT WITH_V ## -## Ends in an error in state: 189. +## Ends in an error in state: 207. ## ## definition -> qident . option(definition_parameters) option(condition_consequence) DEFINED_AS expression [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -645,15 +645,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 185, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident -## In state 167, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) +## In state 203, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident +## In state 185, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) ## expected the defined as keyword to introduce the definition of this variable source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON DEFINITION YEAR ## -## Ends in an error in state: 188. +## Ends in an error in state: 206. ## ## scope_item -> DEFINITION . definition [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -665,7 +665,7 @@ expected the name of the variable you want to define source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT DOT YEAR ## -## Ends in an error in state: 186. +## Ends in an error in state: 204. ## ## separated_nonempty_list(DOT,ident) -> ident DOT . separated_nonempty_list(DOT,ident) [ WITH_V UNDER_CONDITION OF NOT FILLED DEFINED_AS BY ] ## @@ -677,7 +677,7 @@ expected a struct field or a sub-scope context item after the dot source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT NOT FALSE ## -## Ends in an error in state: 174. +## Ends in an error in state: 192. ## ## rule_consequence -> option(NOT) . FILLED [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -689,7 +689,7 @@ expected the filled keyword the this rule source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT OF IDENT YEAR ## -## Ends in an error in state: 168. +## Ends in an error in state: 186. ## ## rule -> rule_expr . option(condition_consequence) rule_consequence [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -701,7 +701,7 @@ expected the expression of the rule source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT OF YEAR ## -## Ends in an error in state: 181. +## Ends in an error in state: 199. ## ## definition_parameters -> OF . ident [ UNDER_CONDITION NOT FILLED DEFINED_AS ] ## @@ -713,7 +713,7 @@ expected the name of the parameter for this dependent variable source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT UNDER_CONDITION TRUE CONSEQUENCE FALSE ## -## Ends in an error in state: 171. +## Ends in an error in state: 189. ## ## rule -> rule_expr option(condition_consequence) . rule_consequence [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -725,7 +725,7 @@ expected filled or not filled for a rule consequence source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT WITH_V ## -## Ends in an error in state: 180. +## Ends in an error in state: 198. ## ## rule_expr -> qident . option(definition_parameters) [ UNDER_CONDITION NOT FILLED ] ## @@ -736,15 +736,15 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 185, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident -## In state 167, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) +## In state 203, spurious reduction of production separated_nonempty_list(DOT,ident) -> ident +## In state 185, spurious reduction of production qident -> separated_nonempty_list(DOT,ident) ## expected a condition or a consequence for this rule source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE IDENT YEAR ## -## Ends in an error in state: 185. +## Ends in an error in state: 203. ## ## separated_nonempty_list(DOT,ident) -> ident . [ WITH_V UNDER_CONDITION OF NOT FILLED DEFINED_AS BY ] ## separated_nonempty_list(DOT,ident) -> ident . DOT separated_nonempty_list(DOT,ident) [ WITH_V UNDER_CONDITION OF NOT FILLED DEFINED_AS BY ] @@ -757,7 +757,7 @@ expected a condition or a consequence for this rule, or the rest of the variable source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON RULE YEAR ## -## Ends in an error in state: 166. +## Ends in an error in state: 184. ## ## scope_item -> RULE . rule [ SCOPE RULE END_CODE DEFINITION DECLARATION ASSERTION ] ## @@ -769,7 +769,7 @@ expected the name of the variable subject to the rule source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR COLON YEAR ## -## Ends in an error in state: 165. +## Ends in an error in state: 183. ## ## code_item -> SCOPE constructor option(scope_use_condition) COLON . nonempty_list(scope_item) [ SCOPE END_CODE DECLARATION ] ## @@ -781,10 +781,10 @@ expected a scope use item: a rule, definition or assertion source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION CARDINAL YEAR ## -## Ends in an error in state: 49. +## Ends in an error in state: 51. ## ## aggregate_func -> CARDINAL . [ FOR ] -## primitive_expression -> CARDINAL . [ WITH THEN SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## primitive_expression -> CARDINAL . [ WITH THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## CARDINAL @@ -794,11 +794,11 @@ expected the keyword following cardinal to compute the number of elements in a s source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION CONSTRUCTOR CONTENT TRUE YEAR ## -## Ends in an error in state: 117. +## Ends in an error in state: 135. ## -## enum_inject_content -> CONTENT small_expression . [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## small_expression -> small_expression . ARROW constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] -## small_expression -> small_expression . DOT ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## enum_inject_content -> CONTENT small_expression . [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## small_expression -> small_expression . ARROW constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## small_expression -> small_expression . DOT ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## CONTENT small_expression @@ -808,9 +808,9 @@ the expression for the content of the enum case is already well-formed, expected source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION CONSTRUCTOR CONTENT YEAR ## -## Ends in an error in state: 116. +## Ends in an error in state: 134. ## -## enum_inject_content -> CONTENT . small_expression [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## enum_inject_content -> CONTENT . small_expression [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## CONTENT @@ -820,9 +820,9 @@ expected an expression for the content of this enum case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION CONSTRUCTOR YEAR ## -## Ends in an error in state: 69. +## Ends in an error in state: 71. ## -## struct_or_enum_inject -> constructor . struct_or_enum_inject_content [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## struct_or_enum_inject -> constructor . struct_or_enum_inject_content [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## constructor @@ -832,7 +832,7 @@ expected a payload for the enum case constructor, or the rest of the expression source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS IDENT IN CARDINAL SUCH THAT YEAR ## -## Ends in an error in state: 132. +## Ends in an error in state: 150. ## ## expression -> exists_prefix . expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -844,9 +844,9 @@ expected an expression for the existential test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS IDENT IN TRUE SUCH YEAR ## -## Ends in an error in state: 138. +## Ends in an error in state: 156. ## -## exists_prefix -> exists_marked ident IN primitive_expression SUCH . THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## exists_prefix -> exists_marked ident IN primitive_expression SUCH . THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## exists_marked ident IN primitive_expression SUCH @@ -856,9 +856,9 @@ expected a keyword to complete the "such that" construction source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS IDENT IN TRUE WITH ## -## Ends in an error in state: 137. +## Ends in an error in state: 155. ## -## exists_prefix -> exists_marked ident IN primitive_expression . SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## exists_prefix -> exists_marked ident IN primitive_expression . SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## exists_marked ident IN primitive_expression @@ -867,16 +867,16 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression ## expected a keyword to form the "such that" expression for the existential test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS IDENT IN YEAR ## -## Ends in an error in state: 136. +## Ends in an error in state: 154. ## -## exists_prefix -> exists_marked ident IN . primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## exists_prefix -> exists_marked ident IN . primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## exists_marked ident IN @@ -886,9 +886,9 @@ expected an expression that designates the set subject to the existential test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS IDENT YEAR ## -## Ends in an error in state: 135. +## Ends in an error in state: 153. ## -## exists_prefix -> exists_marked ident . IN primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## exists_prefix -> exists_marked ident . IN primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## exists_marked ident @@ -898,9 +898,9 @@ expected the "in" keyword to continue this existential test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION EXISTS YEAR ## -## Ends in an error in state: 134. +## Ends in an error in state: 152. ## -## exists_prefix -> exists_marked . ident IN primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## exists_prefix -> exists_marked . ident IN primitive_expression SUCH THAT [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## exists_marked @@ -910,7 +910,7 @@ expected an identifier that will designate the existential witness for the test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR ALL IDENT IN CARDINAL WE_HAVE YEAR ## -## Ends in an error in state: 125. +## Ends in an error in state: 143. ## ## expression -> forall_prefix . expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -922,9 +922,9 @@ expected an expression for the universal test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR ALL IDENT IN TRUE WITH ## -## Ends in an error in state: 129. +## Ends in an error in state: 147. ## -## forall_prefix -> for_all_marked ident IN primitive_expression . WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## forall_prefix -> for_all_marked ident IN primitive_expression . WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## for_all_marked ident IN primitive_expression @@ -933,16 +933,16 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression ## expected the "we have" keyword for this universal test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR ALL IDENT IN YEAR ## -## Ends in an error in state: 128. +## Ends in an error in state: 146. ## -## forall_prefix -> for_all_marked ident IN . primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## forall_prefix -> for_all_marked ident IN . primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## for_all_marked ident IN @@ -952,9 +952,9 @@ expected the expression designating the set on which to perform the universal te source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR ALL IDENT YEAR ## -## Ends in an error in state: 127. +## Ends in an error in state: 145. ## -## forall_prefix -> for_all_marked ident . IN primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## forall_prefix -> for_all_marked ident . IN primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## for_all_marked ident @@ -964,9 +964,9 @@ expected the "in" keyword for the rest of the universal test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR ALL YEAR ## -## Ends in an error in state: 126. +## Ends in an error in state: 144. ## -## forall_prefix -> for_all_marked . ident IN primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] +## forall_prefix -> for_all_marked . ident IN primitive_expression WE_HAVE [ VERTICAL TRUE SUM NOW NOT MONEY_AMOUNT MINUSMONEY MINUSDEC MINUS MATCH LPAREN INT_LITERAL IF IDENT FOR FALSE EXISTS DECIMAL_LITERAL CONSTRUCTOR CARDINAL ] ## ## The known suffix of the stack is as follows: ## for_all_marked @@ -976,7 +976,7 @@ expected an identifier for the bound variable of the universal test source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION FOR YEAR ## -## Ends in an error in state: 44. +## Ends in an error in state: 46. ## ## for_all_marked -> FOR . ALL [ IDENT ] ## @@ -988,7 +988,7 @@ expected the "all" keyword to mean the "for all" construction of the universal t source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION IF TRUE SCOPE ## -## Ends in an error in state: 140. +## Ends in an error in state: 158. ## ## expression -> IF expression . THEN expression ELSE base_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -999,20 +999,20 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression ## expected the "then" keyword as the conditional expression is complete source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION IF TRUE THEN TRUE ELSE YEAR ## -## Ends in an error in state: 143. +## Ends in an error in state: 161. ## ## expression -> IF expression THEN expression ELSE . base_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1024,7 +1024,7 @@ expected an expression for the "else" branch of this conditional construction source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION IF TRUE THEN TRUE THEN ## -## Ends in an error in state: 142. +## Ends in an error in state: 160. ## ## expression -> IF expression THEN expression . ELSE base_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1035,20 +1035,20 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression ## expected the "else" branch of this conditional expression as the "then" branch is complete source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION IF TRUE THEN YEAR ## -## Ends in an error in state: 141. +## Ends in an error in state: 159. ## ## expression -> IF expression THEN . expression ELSE base_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1060,7 +1060,7 @@ expected an expression the for the "then" branch of the conditiona source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION IF YEAR ## -## Ends in an error in state: 42. +## Ends in an error in state: 44. ## ## expression -> IF . expression THEN expression ELSE base_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1072,9 +1072,9 @@ expected an expression for the test of the conditional source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION INT_LITERAL WITH_V ## -## Ends in an error in state: 62. +## Ends in an error in state: 64. ## -## literal -> num_literal . option(unit_literal) [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> num_literal . option(unit_literal) [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## num_literal @@ -1084,9 +1084,9 @@ expected a unit for this literal, or a valid operator to complete the expression source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION LPAREN TRUE THEN ## -## Ends in an error in state: 145. +## Ends in an error in state: 163. ## -## atomic_expression -> LPAREN expression . RPAREN [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## atomic_expression -> LPAREN expression . RPAREN [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## LPAREN expression @@ -1095,22 +1095,22 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression ## unmatched parenthesis that should have been closed by here source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION LPAREN YEAR ## -## Ends in an error in state: 40. +## Ends in an error in state: 42. ## -## atomic_expression -> LPAREN . expression RPAREN [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## atomic_expression -> LPAREN . expression RPAREN [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## LPAREN @@ -1120,7 +1120,7 @@ expected an expression inside the parenthesis source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WE_HAVE ## -## Ends in an error in state: 147. +## Ends in an error in state: 165. ## ## expression -> MATCH primitive_expression . WITH match_arms [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1131,14 +1131,14 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression ## expected the "with patter" keyword to complete the pattern matching expression source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR COLON NOT TRUE OR ## -## Ends in an error in state: 150. +## Ends in an error in state: 168. ## ## match_arms -> ALT match_arm . match_arms [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1149,20 +1149,20 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 107, spurious reduction of production logical_expression -> logical_unop compare_expression -## In state 154, spurious reduction of production match_arm -> constructor_binding COLON logical_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 125, spurious reduction of production logical_expression -> logical_unop compare_expression +## In state 172, spurious reduction of production match_arm -> constructor_binding COLON logical_expression ## expected another match case or the rest of the expression since the previous match case is complete source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR COLON YEAR ## -## Ends in an error in state: 153. +## Ends in an error in state: 171. ## ## match_arm -> constructor_binding COLON . logical_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ALT ] ## @@ -1174,7 +1174,7 @@ expected an expression for this pattern matching case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR OF CONSTRUCTOR YEAR ## -## Ends in an error in state: 158. +## Ends in an error in state: 176. ## ## optional_binding -> OF constructor . constructor_binding [ COLON ] ## @@ -1186,7 +1186,7 @@ expected a colon or a binding for the enum constructor payload source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR OF IDENT YEAR ## -## Ends in an error in state: 152. +## Ends in an error in state: 170. ## ## match_arm -> constructor_binding . COLON logical_expression [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ALT ] ## @@ -1198,7 +1198,7 @@ expected a colon and then the expression for this matching case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR OF YEAR ## -## Ends in an error in state: 156. +## Ends in an error in state: 174. ## ## optional_binding -> OF . ident [ COLON ] ## optional_binding -> OF . constructor constructor_binding [ COLON ] @@ -1211,7 +1211,7 @@ expected an identifier for this enum case binding source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT CONSTRUCTOR YEAR ## -## Ends in an error in state: 155. +## Ends in an error in state: 173. ## ## constructor_binding -> constructor . optional_binding [ COLON ] ## @@ -1223,7 +1223,7 @@ expected a binding for the constructor payload, or a colon and the matching case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH ALT YEAR ## -## Ends in an error in state: 149. +## Ends in an error in state: 167. ## ## match_arms -> ALT . match_arm match_arms [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1235,7 +1235,7 @@ expected the name of the constructor for the enum case in the pattern matching source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH TRUE WITH YEAR ## -## Ends in an error in state: 148. +## Ends in an error in state: 166. ## ## expression -> MATCH primitive_expression WITH . match_arms [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1247,7 +1247,7 @@ expected a pattern matching case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MATCH YEAR ## -## Ends in an error in state: 39. +## Ends in an error in state: 41. ## ## expression -> MATCH . primitive_expression WITH match_arms [ THEN SCOPE RULE RPAREN END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ] ## @@ -1259,9 +1259,9 @@ expected an expression to match with source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION MINUS YEAR ## -## Ends in an error in state: 50. +## Ends in an error in state: 52. ## -## sum_expression -> sum_unop . sum_expression [ THEN SCOPE RULE RPAREN RBRACKET OR NOT_EQUAL LESSER_EQUAL LESSER GREATER_EQUAL GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## sum_expression -> sum_unop . sum_expression [ THEN SCOPE RULE RPAREN RBRACKET OR NOT_EQUAL LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## sum_unop @@ -1271,7 +1271,7 @@ expected an expression to take the opposite of source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION NOT YEAR ## -## Ends in an error in state: 106. +## Ends in an error in state: 124. ## ## logical_expression -> logical_unop . compare_expression [ THEN SCOPE RULE RPAREN RBRACKET END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ALT ] ## @@ -1283,9 +1283,9 @@ expected an expression to take the negation of source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM FOR IDENT IN TRUE OF YEAR ## -## Ends in an error in state: 102. +## Ends in an error in state: 120. ## -## aggregate -> aggregate_func FOR ident IN primitive_expression OF . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func FOR ident IN primitive_expression OF . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func FOR ident IN primitive_expression OF @@ -1295,9 +1295,9 @@ expected an expression to compute its aggregation over the set source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM FOR IDENT IN TRUE WITH ## -## Ends in an error in state: 101. +## Ends in an error in state: 119. ## -## aggregate -> aggregate_func FOR ident IN primitive_expression . OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func FOR ident IN primitive_expression . OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func FOR ident IN primitive_expression @@ -1306,16 +1306,16 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression ## expected the "for" keyword and the expression to compute the aggregate source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM FOR IDENT IN YEAR ## -## Ends in an error in state: 99. +## Ends in an error in state: 117. ## -## aggregate -> aggregate_func FOR ident IN . primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func FOR ident IN . primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func FOR ident IN @@ -1325,9 +1325,9 @@ expected an expression standing for the set over which to compute the aggregatio source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM FOR IDENT YEAR ## -## Ends in an error in state: 98. +## Ends in an error in state: 116. ## -## aggregate -> aggregate_func FOR ident . IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func FOR ident . IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func FOR ident @@ -1337,9 +1337,9 @@ expected the "in" keyword source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM FOR YEAR ## -## Ends in an error in state: 97. +## Ends in an error in state: 115. ## -## aggregate -> aggregate_func FOR . ident IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func FOR . ident IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func FOR @@ -1349,9 +1349,9 @@ expected an identifier for the aggregation bound variable source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION SUM YEAR ## -## Ends in an error in state: 96. +## Ends in an error in state: 114. ## -## aggregate -> aggregate_func . FOR ident IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## aggregate -> aggregate_func . FOR ident IN primitive_expression OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## aggregate_func @@ -1361,9 +1361,9 @@ expected the "for" keyword to spell the aggregation source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE ARROW YEAR ## -## Ends in an error in state: 56. +## Ends in an error in state: 58. ## -## small_expression -> small_expression ARROW . constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## small_expression -> small_expression ARROW . constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## small_expression ARROW @@ -1373,7 +1373,7 @@ expected a constructor, to get the payload of this enum case source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE ASSERTION ## -## Ends in an error in state: 164. +## Ends in an error in state: 182. ## ## code_item -> SCOPE constructor option(scope_use_condition) . COLON nonempty_list(scope_item) [ SCOPE END_CODE DECLARATION ] ## @@ -1384,24 +1384,24 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression -## In state 90, spurious reduction of production mult_expression -> base_expression -## In state 85, spurious reduction of production sum_expression -> mult_expression -## In state 77, spurious reduction of production compare_expression -> sum_expression -## In state 109, spurious reduction of production logical_expression -> compare_expression -## In state 124, spurious reduction of production expression -> logical_expression -## In state 162, spurious reduction of production scope_use_condition -> UNDER_CONDITION expression -## In state 163, spurious reduction of production option(scope_use_condition) -> scope_use_condition +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression +## In state 104, spurious reduction of production mult_expression -> base_expression +## In state 95, spurious reduction of production sum_expression -> mult_expression +## In state 79, spurious reduction of production compare_expression -> sum_expression +## In state 127, spurious reduction of production logical_expression -> compare_expression +## In state 142, spurious reduction of production expression -> logical_expression +## In state 180, spurious reduction of production scope_use_condition -> UNDER_CONDITION expression +## In state 181, spurious reduction of production option(scope_use_condition) -> scope_use_condition ## expected a colon after the scope use precondition source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE DOT YEAR ## -## Ends in an error in state: 54. +## Ends in an error in state: 56. ## -## small_expression -> small_expression DOT . ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## small_expression -> small_expression DOT . ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## small_expression DOT @@ -1411,9 +1411,9 @@ expected an identifier standing for a struct field or a subscope name source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE IN YEAR ## -## Ends in an error in state: 122. +## Ends in an error in state: 140. ## -## base_expression -> primitive_expression IN . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression IN . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## primitive_expression IN @@ -1423,10 +1423,10 @@ expected an expression standing for the set you want to test for membership source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE INCREASING ## -## Ends in an error in state: 90. +## Ends in an error in state: 104. ## -## mult_expression -> base_expression . [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MINUS LESSER_EQUAL LESSER GREATER_EQUAL GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## mult_expression -> base_expression . mult_op mult_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MINUS LESSER_EQUAL LESSER GREATER_EQUAL GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## mult_expression -> base_expression . [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## mult_expression -> base_expression . mult_op mult_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## base_expression @@ -1435,17 +1435,17 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression -## In state 58, spurious reduction of production base_expression -> primitive_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression +## In state 60, spurious reduction of production base_expression -> primitive_expression ## expected an operator to compose the expression on the left source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE MULT YEAR ## -## Ends in an error in state: 93. +## Ends in an error in state: 111. ## -## mult_expression -> base_expression mult_op . mult_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MINUS LESSER_EQUAL LESSER GREATER_EQUAL GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## mult_expression -> base_expression mult_op . mult_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## base_expression mult_op @@ -1455,7 +1455,7 @@ expected an expression on the right side of the multiplication or division opera source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE NOT_EQUAL YEAR ## -## Ends in an error in state: 84. +## Ends in an error in state: 94. ## ## compare_expression -> sum_expression compare_op . compare_expression [ THEN SCOPE RULE RPAREN RBRACKET OR END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## @@ -1467,9 +1467,9 @@ expected an expression on the right side of the comparison operator source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE OF YEAR ## -## Ends in an error in state: 61. +## Ends in an error in state: 63. ## -## base_expression -> primitive_expression OF . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression OF . base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## primitive_expression OF @@ -1479,7 +1479,7 @@ expected an expression for the argument of this function call source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE OR YEAR ## -## Ends in an error in state: 112. +## Ends in an error in state: 130. ## ## logical_expression -> compare_expression logical_op . logical_expression [ THEN SCOPE RULE RPAREN RBRACKET END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION ALT ] ## @@ -1491,9 +1491,9 @@ expected an expression on the right side of the logical operator source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE PLUS YEAR ## -## Ends in an error in state: 88. +## Ends in an error in state: 102. ## -## sum_expression -> mult_expression sum_op . sum_expression [ THEN SCOPE RULE RPAREN RBRACKET OR NOT_EQUAL LESSER_EQUAL LESSER GREATER_EQUAL GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## sum_expression -> mult_expression sum_op . sum_expression [ THEN SCOPE RULE RPAREN RBRACKET OR NOT_EQUAL LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DEFINITION DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## mult_expression sum_op @@ -1503,12 +1503,12 @@ expected an expression on the right side of the sum or minus operator source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE WE_HAVE ## -## Ends in an error in state: 58. +## Ends in an error in state: 60. ## -## base_expression -> primitive_expression . [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## base_expression -> primitive_expression . OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## base_expression -> primitive_expression . WITH constructor [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## base_expression -> primitive_expression . IN base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression . [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression . OF base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression . WITH constructor [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression . IN base_expression [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## primitive_expression @@ -1517,16 +1517,16 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 53, spurious reduction of production primitive_expression -> small_expression +## In state 55, spurious reduction of production primitive_expression -> small_expression ## expected an operator to compose the expression on the left with source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE WITH YEAR ## -## Ends in an error in state: 59. +## Ends in an error in state: 61. ## -## base_expression -> primitive_expression WITH . constructor [ THEN SCOPE RULE RPAREN RBRACKET PLUS OR NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## base_expression -> primitive_expression WITH . constructor [ THEN SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] ## ## The known suffix of the stack is as follows: ## primitive_expression WITH @@ -1536,11 +1536,11 @@ expected an enum constructor to test if the expression on the left source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION TRUE YEAR ## -## Ends in an error in state: 53. +## Ends in an error in state: 55. ## -## primitive_expression -> small_expression . [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] -## small_expression -> small_expression . ARROW constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] -## small_expression -> small_expression . DOT ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## primitive_expression -> small_expression . [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION AND ALT ] +## small_expression -> small_expression . ARROW constructor [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## small_expression -> small_expression . DOT ident [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## small_expression @@ -1552,7 +1552,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 31. ## -## literal -> VERTICAL date_int DIV date_int DIV date_int . VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL date_int DIV date_int DIV date_int . VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int DIV date_int DIV date_int @@ -1564,7 +1564,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 30. ## -## literal -> VERTICAL date_int DIV date_int DIV . date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL date_int DIV date_int DIV . date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int DIV date_int DIV @@ -1576,7 +1576,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 29. ## -## literal -> VERTICAL date_int DIV date_int . DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL date_int DIV date_int . DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int DIV date_int @@ -1588,7 +1588,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 28. ## -## literal -> VERTICAL date_int DIV . date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL date_int DIV . date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int DIV @@ -1600,7 +1600,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 27. ## -## literal -> VERTICAL date_int . DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL date_int . DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL date_int @@ -1612,7 +1612,7 @@ source_file_or_master: LAW_ARTICLE BEGIN_CODE SCOPE CONSTRUCTOR UNDER_CONDITION ## ## Ends in an error in state: 25. ## -## literal -> VERTICAL . date_int DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUS OR OF NOT_EQUAL MULT MINUS LESSER_EQUAL LESSER INCREASING IN GREATER_EQUAL GREATER EQUAL END_CODE ELSE DOT DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] +## literal -> VERTICAL . date_int DIV date_int DIV date_int VERTICAL [ WITH WE_HAVE THEN SUCH SCOPE RULE RPAREN RBRACKET PLUSMONEY PLUSDEC PLUS OR OF NOT_EQUAL MULTMONEY MULTDEC MULT MINUSMONEY MINUSDEC MINUS LESSER_MONEY LESSER_EQUAL_MONEY LESSER_EQUAL_DEC LESSER_EQUAL LESSER_DEC LESSER INCREASING IN GREATER_MONEY GREATER_EQUAL_MONEY GREATER_EQUAL_DEC GREATER_EQUAL GREATER_DEC GREATER EQUAL END_CODE ELSE DOT DIVMONEY DIVDEC DIV DEFINITION DECREASING DECLARATION CONSEQUENCE COLON ASSERTION ARROW AND ALT ] ## ## The known suffix of the stack is as follows: ## VERTICAL @@ -1658,7 +1658,7 @@ expected the name of the scope you want to use source_file_or_master: LAW_ARTICLE BEGIN_CODE YEAR ## -## Ends in an error in state: 290. +## Ends in an error in state: 308. ## ## law_article_item -> BEGIN_CODE . code END_CODE [ LAW_TEXT LAW_INCLUDE LAW_HEADING LAW_ARTICLE EOF BEGIN_METADATA BEGIN_CODE ] ## @@ -1670,7 +1670,7 @@ expected a declaration or a scope use source_file_or_master: LAW_ARTICLE LAW_TEXT YEAR ## -## Ends in an error in state: 295. +## Ends in an error in state: 313. ## ## law_articles_items -> law_article_item . law_articles_items [ LAW_HEADING LAW_ARTICLE EOF BEGIN_METADATA ] ## @@ -1682,7 +1682,7 @@ expected a code block, a metadata block, more law text or a heading source_file_or_master: LAW_ARTICLE YEAR ## -## Ends in an error in state: 288. +## Ends in an error in state: 306. ## ## source_file_article -> law_article . law_articles_items [ LAW_HEADING LAW_ARTICLE EOF BEGIN_METADATA ] ## @@ -1694,7 +1694,7 @@ expected a code block, a metadata block, more law text or a heading source_file_or_master: LAW_HEADING YEAR ## -## Ends in an error in state: 283. +## Ends in an error in state: 301. ## ## source_file_after_text -> source_file_item . list(law_intermediate_text) source_file_after_text [ # ] ## diff --git a/src/catala/catala_surface/parser.mly b/src/catala/catala_surface/parser.mly index f0a6ddc1..ebd7a489 100644 --- a/src/catala/catala_surface/parser.mly +++ b/src/catala/catala_surface/parser.mly @@ -42,11 +42,16 @@ %token COLON ALT DATA VERTICAL %token OF INTEGER COLLECTION %token RULE CONDITION DEFINED_AS -%token EXISTS IN SUCH THAT NOW LESSER GREATER +%token LESSER GREATER LESSER_EQUAL GREATER_EQUAL +%token LESSER_DEC GREATER_DEC LESSER_EQUAL_DEC GREATER_EQUAL_DEC +%token LESSER_MONEY GREATER_MONEY LESSER_EQUAL_MONEY GREATER_EQUAL_MONEY +%token EXISTS IN SUCH THAT NOW %token DOT AND OR LPAREN RPAREN OPTIONAL EQUAL -%token CARDINAL LESSER_EQUAL GREATER_EQUAL -%token ASSERTION FIXED BY YEAR -%token PLUS MINUS MULT DIV MATCH WITH VARIES WITH_V +%token CARDINAL ASSERTION FIXED BY YEAR +%token PLUS MINUS MULT DIV +%token PLUSDEC MINUSDEC MULTDEC DIVDEC +%token PLUSMONEY MINUSMONEY MULTMONEY DIVMONEY +%token MATCH WITH VARIES WITH_V %token FOR ALL WE_HAVE INCREASING DECREASING %token NOT BOOLEAN PERCENT ARROW %token SCOPE FILLED NOT_EQUAL DEFINITION @@ -177,10 +182,18 @@ literal: | FALSE { (Bool false, $sloc) } compare_op: -| LESSER { (Lt, $sloc) } -| LESSER_EQUAL { (Lte, $sloc) } -| GREATER { (Gt, $sloc) } -| GREATER_EQUAL { (Gte, $sloc) } +| LESSER { (Lt KInt, $sloc) } +| LESSER_EQUAL { (Lte KInt, $sloc) } +| GREATER { (Gt KInt, $sloc) } +| GREATER_EQUAL { (Gte KInt, $sloc) } +| LESSER_DEC { (Lt KDec, $sloc) } +| LESSER_EQUAL_DEC { (Lte KDec, $sloc) } +| GREATER_DEC { (Gt KDec, $sloc) } +| GREATER_EQUAL_DEC { (Gte KDec, $sloc) } +| LESSER_MONEY { (Lt KMoney, $sloc) } +| LESSER_EQUAL_MONEY { (Lte KMoney, $sloc) } +| GREATER_MONEY { (Gt KMoney, $sloc) } +| GREATER_EQUAL_MONEY { (Gte KMoney, $sloc) } | EQUAL { (Eq, $sloc) } | NOT_EQUAL { (Neq, $sloc) } @@ -208,8 +221,12 @@ base_expression: } mult_op: -| MULT { (Mult, $sloc) } -| DIV { (Div, $sloc) } +| MULT { (Mult KInt, $sloc) } +| DIV { (Div KInt, $sloc) } +| MULTDEC { (Mult KDec, $sloc) } +| DIVDEC { (Div KDec, $sloc) } +| MULTMONEY { (Mult KMoney, $sloc) } +| DIVMONEY { (Div KMoney, $sloc) } mult_expression: | e = base_expression { e } @@ -218,11 +235,17 @@ mult_expression: } sum_op: -| PLUS { (Add, $sloc) } -| MINUS { (Sub, $sloc) } +| PLUSMONEY { (Add KMoney, $sloc) } +| MINUSMONEY { (Sub KMoney, $sloc) } +| PLUSDEC { (Add KDec, $sloc) } +| MINUSDEC { (Sub KDec, $sloc) } +| PLUS { (Add KInt, $sloc) } +| MINUS { (Sub KInt, $sloc) } sum_unop: -| MINUS { (Minus, $sloc) } +| MINUS { (Minus KInt, $sloc) } +| MINUSDEC { (Minus KDec, $sloc) } +| MINUSMONEY { (Minus KMoney, $sloc) } sum_expression: | e = mult_expression { e } diff --git a/src/catala/catala_surface/parser_errors.ml b/src/catala/catala_surface/parser_errors.ml index 7427baca..c630f3af 100644 --- a/src/catala/catala_surface/parser_errors.ml +++ b/src/catala/catala_surface/parser_errors.ml @@ -11,10 +11,10 @@ let message s = | 7 -> "expected another inclusion of a Catala file, since this file is a master file which can \ only contain inclusions of other Catala files\n" - | 283 -> "expected some text, another heading or a law article\n" - | 288 -> "expected a code block, a metadata block, more law text or a heading\n" - | 295 -> "expected a code block, a metadata block, more law text or a heading\n" - | 290 -> "expected a declaration or a scope use\n" + | 301 -> "expected some text, another heading or a law article\n" + | 306 -> "expected a code block, a metadata block, more law text or a heading\n" + | 313 -> "expected a code block, a metadata block, more law text or a heading\n" + | 308 -> "expected a declaration or a scope use\n" | 21 -> "expected the name of the scope you want to use\n" | 23 -> "expected a scope use precondition or a colon\n" | 24 -> "expected an expression which will act as the condition\n" @@ -24,133 +24,133 @@ let message s = | 29 -> "expected a \"/\"\n" | 30 -> "expected the third component of the date literal\n" | 31 -> "expected a delimiter to finish the date literal\n" - | 53 -> "expected an operator to compose the expression on the left with\n" - | 59 -> "expected an enum constructor to test if the expression on the left\n" - | 58 -> "expected an operator to compose the expression on the left with\n" - | 88 -> "expected an expression on the right side of the sum or minus operator\n" - | 112 -> "expected an expression on the right side of the logical operator\n" - | 61 -> "expected an expression for the argument of this function call\n" - | 84 -> "expected an expression on the right side of the comparison operator\n" - | 93 -> "expected an expression on the right side of the multiplication or division operator\n" - | 90 -> "expected an operator to compose the expression on the left\n" - | 122 -> "expected an expression standing for the set you want to test for membership\n" - | 54 -> "expected an identifier standing for a struct field or a subscope name\n" - | 164 -> "expected a colon after the scope use precondition\n" - | 56 -> "expected a constructor, to get the payload of this enum case\n" - | 96 -> "expected the \"for\" keyword to spell the aggregation\n" - | 97 -> "expected an identifier for the aggregation bound variable\n" - | 98 -> "expected the \"in\" keyword\n" - | 99 -> + | 55 -> "expected an operator to compose the expression on the left with\n" + | 61 -> "expected an enum constructor to test if the expression on the left\n" + | 60 -> "expected an operator to compose the expression on the left with\n" + | 102 -> "expected an expression on the right side of the sum or minus operator\n" + | 130 -> "expected an expression on the right side of the logical operator\n" + | 63 -> "expected an expression for the argument of this function call\n" + | 94 -> "expected an expression on the right side of the comparison operator\n" + | 111 -> "expected an expression on the right side of the multiplication or division operator\n" + | 104 -> "expected an operator to compose the expression on the left\n" + | 140 -> "expected an expression standing for the set you want to test for membership\n" + | 56 -> "expected an identifier standing for a struct field or a subscope name\n" + | 182 -> "expected a colon after the scope use precondition\n" + | 58 -> "expected a constructor, to get the payload of this enum case\n" + | 114 -> "expected the \"for\" keyword to spell the aggregation\n" + | 115 -> "expected an identifier for the aggregation bound variable\n" + | 116 -> "expected the \"in\" keyword\n" + | 117 -> "expected an expression standing for the set over which to compute the aggregation operation\n" - | 101 -> "expected the \"for\" keyword and the expression to compute the aggregate\n" - | 102 -> "expected an expression to compute its aggregation over the set\n" - | 106 -> "expected an expression to take the negation of\n" - | 50 -> "expected an expression to take the opposite of\n" - | 39 -> "expected an expression to match with\n" - | 148 -> "expected a pattern matching case\n" - | 149 -> "expected the name of the constructor for the enum case in the pattern matching\n" - | 155 -> + | 119 -> "expected the \"for\" keyword and the expression to compute the aggregate\n" + | 120 -> "expected an expression to compute its aggregation over the set\n" + | 124 -> "expected an expression to take the negation of\n" + | 52 -> "expected an expression to take the opposite of\n" + | 41 -> "expected an expression to match with\n" + | 166 -> "expected a pattern matching case\n" + | 167 -> "expected the name of the constructor for the enum case in the pattern matching\n" + | 173 -> "expected a binding for the constructor payload, or a colon and the matching case expression\n" - | 156 -> "expected an identifier for this enum case binding\n" - | 152 -> "expected a colon and then the expression for this matching case\n" - | 158 -> "expected a colon or a binding for the enum constructor payload\n" - | 153 -> "expected an expression for this pattern matching case\n" - | 150 -> + | 174 -> "expected an identifier for this enum case binding\n" + | 170 -> "expected a colon and then the expression for this matching case\n" + | 176 -> "expected a colon or a binding for the enum constructor payload\n" + | 171 -> "expected an expression for this pattern matching case\n" + | 168 -> "expected another match case or the rest of the expression since the previous match case is \ complete\n" - | 147 -> "expected the \"with patter\" keyword to complete the pattern matching expression\n" - | 40 -> "expected an expression inside the parenthesis\n" - | 145 -> "unmatched parenthesis that should have been closed by here\n" - | 62 -> "expected a unit for this literal, or a valid operator to complete the expression \n" - | 42 -> "expected an expression for the test of the conditional\n" - | 141 -> "expected an expression the for the \"then\" branch of the conditiona\n" - | 142 -> + | 165 -> "expected the \"with patter\" keyword to complete the pattern matching expression\n" + | 42 -> "expected an expression inside the parenthesis\n" + | 163 -> "unmatched parenthesis that should have been closed by here\n" + | 64 -> "expected a unit for this literal, or a valid operator to complete the expression \n" + | 44 -> "expected an expression for the test of the conditional\n" + | 159 -> "expected an expression the for the \"then\" branch of the conditiona\n" + | 160 -> "expected the \"else\" branch of this conditional expression as the \"then\" branch is \ complete\n" - | 143 -> "expected an expression for the \"else\" branch of this conditional construction\n" - | 140 -> "expected the \"then\" keyword as the conditional expression is complete\n" - | 44 -> + | 161 -> "expected an expression for the \"else\" branch of this conditional construction\n" + | 158 -> "expected the \"then\" keyword as the conditional expression is complete\n" + | 46 -> "expected the \"all\" keyword to mean the \"for all\" construction of the universal test\n" - | 126 -> "expected an identifier for the bound variable of the universal test\n" - | 127 -> "expected the \"in\" keyword for the rest of the universal test\n" - | 128 -> "expected the expression designating the set on which to perform the universal test\n" - | 129 -> "expected the \"we have\" keyword for this universal test\n" - | 125 -> "expected an expression for the universal test\n" - | 134 -> "expected an identifier that will designate the existential witness for the test\n" - | 135 -> "expected the \"in\" keyword to continue this existential test\n" - | 136 -> "expected an expression that designates the set subject to the existential test\n" - | 137 -> "expected a keyword to form the \"such that\" expression for the existential test\n" - | 138 -> "expected a keyword to complete the \"such that\" construction\n" - | 132 -> "expected an expression for the existential test\n" - | 69 -> + | 144 -> "expected an identifier for the bound variable of the universal test\n" + | 145 -> "expected the \"in\" keyword for the rest of the universal test\n" + | 146 -> "expected the expression designating the set on which to perform the universal test\n" + | 147 -> "expected the \"we have\" keyword for this universal test\n" + | 143 -> "expected an expression for the universal test\n" + | 152 -> "expected an identifier that will designate the existential witness for the test\n" + | 153 -> "expected the \"in\" keyword to continue this existential test\n" + | 154 -> "expected an expression that designates the set subject to the existential test\n" + | 155 -> "expected a keyword to form the \"such that\" expression for the existential test\n" + | 156 -> "expected a keyword to complete the \"such that\" construction\n" + | 150 -> "expected an expression for the existential test\n" + | 71 -> "expected a payload for the enum case constructor, or the rest of the expression (with an \ operator ?)\n" - | 116 -> "expected an expression for the content of this enum case\n" - | 117 -> + | 134 -> "expected an expression for the content of this enum case\n" + | 135 -> "the expression for the content of the enum case is already well-formed, expected an \ operator to form a bigger expression\n" - | 49 -> "expected the keyword following cardinal to compute the number of elements in a set\n" - | 165 -> "expected a scope use item: a rule, definition or assertion\n" - | 166 -> "expected the name of the variable subject to the rule\n" - | 185 -> + | 51 -> "expected the keyword following cardinal to compute the number of elements in a set\n" + | 183 -> "expected a scope use item: a rule, definition or assertion\n" + | 184 -> "expected the name of the variable subject to the rule\n" + | 203 -> "expected a condition or a consequence for this rule, or the rest of the variable qualified \ name\n" - | 180 -> "expected a condition or a consequence for this rule\n" - | 171 -> "expected filled or not filled for a rule consequence\n" - | 181 -> "expected the name of the parameter for this dependent variable \n" - | 168 -> "expected the expression of the rule\n" - | 174 -> "expected the filled keyword the this rule \n" - | 186 -> "expected a struct field or a sub-scope context item after the dot\n" - | 188 -> "expected the name of the variable you want to define\n" - | 189 -> "expected the defined as keyword to introduce the definition of this variable\n" - | 191 -> "expected an expression for the consequence of this definition under condition\n" - | 190 -> + | 198 -> "expected a condition or a consequence for this rule\n" + | 189 -> "expected filled or not filled for a rule consequence\n" + | 199 -> "expected the name of the parameter for this dependent variable \n" + | 186 -> "expected the expression of the rule\n" + | 192 -> "expected the filled keyword the this rule \n" + | 204 -> "expected a struct field or a sub-scope context item after the dot\n" + | 206 -> "expected the name of the variable you want to define\n" + | 207 -> "expected the defined as keyword to introduce the definition of this variable\n" + | 209 -> "expected an expression for the consequence of this definition under condition\n" + | 208 -> "expected a expression for defining this function, introduced by the defined as keyword\n" - | 192 -> "expected an expression for the definition\n" - | 195 -> "expected an expression that shoud be asserted during execution\n" - | 196 -> "expecting the name of the varying variable\n" - | 198 -> "the variable varies with an expression that was expected here\n" - | 199 -> "expected an indication about the variation sense of the variable, or a new scope item\n" - | 197 -> "expected an indication about what this variable varies with\n" - | 169 -> "expected an expression for this condition\n" - | 177 -> "expected a consequence for this definition under condition\n" - | 208 -> "expected an expression for this definition under condition\n" - | 204 -> "expected the name of the variable that should be fixed\n" - | 205 -> "expected the legislative text by which the value of the variable is fixed\n" - | 206 -> "expected the legislative text by which the value of the variable is fixed\n" - | 212 -> "expected a new scope use item \n" - | 215 -> "expected the kind of the declaration (struct, scope or enum)\n" - | 216 -> "expected the struct name\n" - | 217 -> "expected a colon\n" - | 218 -> "expected struct data or condition\n" - | 219 -> "expected the name of this struct data \n" - | 220 -> "expected the type of this struct data, introduced by the content keyword\n" - | 221 -> "expected the type of this struct data\n" - | 245 -> "expected the name of this struct condition\n" - | 238 -> "expected a new struct data, or another declaration or scope use\n" - | 239 -> "expected the type of the parameter of this struct data function\n" - | 243 -> "expected a new struct data, or another declaration or scope use\n" - | 232 -> "expected a new struct data, or another declaration or scope use\n" - | 235 -> "expected a new struct data, or another declaration or scope use\n" - | 248 -> "expected the name of the scope you are declaring\n" - | 249 -> "expected a colon followed by the list of context items of this scope\n" - | 250 -> "expected a context item introduced by \"context\"\n" - | 251 -> "expected the name of this new context item\n" - | 252 -> "expected the kind of this context item: is it a condition, a sub-scope or a data?\n" - | 253 -> "expected the name of the subscope for this context item\n" - | 260 -> "expected the next context item, or another declaration or scope use\n" - | 255 -> "expected the type of this context item\n" - | 256 -> "expected the next context item or a dependency declaration for this item\n" - | 258 -> "expected the next context item or a dependency declaration for this item\n" - | 263 -> "expected the name of your enum\n" - | 264 -> "expected a colon\n" - | 265 -> "expected an enum case\n" - | 266 -> "expected the name of an enum case \n" - | 267 -> "expected a payload for your enum case, or another case or declaration \n" - | 268 -> "expected a content type\n" - | 273 -> "expected another enum case, or a new declaration or scope use\n" + | 210 -> "expected an expression for the definition\n" + | 213 -> "expected an expression that shoud be asserted during execution\n" + | 214 -> "expecting the name of the varying variable\n" + | 216 -> "the variable varies with an expression that was expected here\n" + | 217 -> "expected an indication about the variation sense of the variable, or a new scope item\n" + | 215 -> "expected an indication about what this variable varies with\n" + | 187 -> "expected an expression for this condition\n" + | 195 -> "expected a consequence for this definition under condition\n" + | 226 -> "expected an expression for this definition under condition\n" + | 222 -> "expected the name of the variable that should be fixed\n" + | 223 -> "expected the legislative text by which the value of the variable is fixed\n" + | 224 -> "expected the legislative text by which the value of the variable is fixed\n" + | 230 -> "expected a new scope use item \n" + | 233 -> "expected the kind of the declaration (struct, scope or enum)\n" + | 234 -> "expected the struct name\n" + | 235 -> "expected a colon\n" + | 236 -> "expected struct data or condition\n" + | 237 -> "expected the name of this struct data \n" + | 238 -> "expected the type of this struct data, introduced by the content keyword\n" + | 239 -> "expected the type of this struct data\n" + | 263 -> "expected the name of this struct condition\n" + | 256 -> "expected a new struct data, or another declaration or scope use\n" + | 257 -> "expected the type of the parameter of this struct data function\n" + | 261 -> "expected a new struct data, or another declaration or scope use\n" + | 250 -> "expected a new struct data, or another declaration or scope use\n" + | 253 -> "expected a new struct data, or another declaration or scope use\n" + | 266 -> "expected the name of the scope you are declaring\n" + | 267 -> "expected a colon followed by the list of context items of this scope\n" + | 268 -> "expected a context item introduced by \"context\"\n" + | 269 -> "expected the name of this new context item\n" + | 270 -> "expected the kind of this context item: is it a condition, a sub-scope or a data?\n" + | 271 -> "expected the name of the subscope for this context item\n" + | 278 -> "expected the next context item, or another declaration or scope use\n" + | 273 -> "expected the type of this context item\n" + | 274 -> "expected the next context item or a dependency declaration for this item\n" + | 276 -> "expected the next context item or a dependency declaration for this item\n" + | 281 -> "expected the name of your enum\n" + | 282 -> "expected a colon\n" + | 283 -> "expected an enum case\n" + | 284 -> "expected the name of an enum case \n" + | 285 -> "expected a payload for your enum case, or another case or declaration \n" + | 286 -> "expected a content type\n" + | 291 -> "expected another enum case, or a new declaration or scope use\n" | 17 -> "expected a declaration or a scope use\n" | 19 -> "expected a declaration or a scope use\n" - | 279 -> + | 297 -> "should not happen, please file an issue at https://github.com/CatalaLang/catala/issues\n" | _ -> raise Not_found diff --git a/src/catala/default_calculus/ast.ml b/src/catala/default_calculus/ast.ml index b1b6105e..e7545959 100644 --- a/src/catala/default_calculus/ast.ml +++ b/src/catala/default_calculus/ast.ml @@ -15,20 +15,33 @@ module Pos = Utils.Pos module Uid = Utils.Uid +type typ_lit = TBool | TUnit | TInt | TRat | TMoney + type typ = - | TBool - | TUnit - | TInt - | TRat + | TLit of typ_lit | TTuple of typ Pos.marked list | TEnum of typ Pos.marked list | TArrow of typ Pos.marked * typ Pos.marked -type lit = LBool of bool | LEmptyError | LInt of Int64.t | LRat of Q.t | LUnit +type lit = LBool of bool | LEmptyError | LInt of Int64.t | LRat of Q.t | LMoney of Z.t | LUnit -type binop = And | Or | Add | Sub | Mult | Div | Lt | Lte | Gt | Gte | Eq | Neq +type op_kind = KInt | KRat | KMoney -type unop = Not | Minus | ErrorOnEmpty +type binop = + | And + | Or + | Add of op_kind + | Sub of op_kind + | Mult of op_kind + | Div of op_kind + | Lt of op_kind + | Lte of op_kind + | Gt of op_kind + | Gte of op_kind + | Eq + | Neq + +type unop = Not | Minus of op_kind | ErrorOnEmpty type operator = Binop of binop | Unop of unop diff --git a/src/catala/default_calculus/interpreter.ml b/src/catala/default_calculus/interpreter.ml index 1a656642..fb5cdbb3 100644 --- a/src/catala/default_calculus/interpreter.ml +++ b/src/catala/default_calculus/interpreter.ml @@ -26,10 +26,10 @@ let evaluate_operator (op : A.operator Pos.marked) (args : A.expr Pos.marked lis ( match (Pos.unmark op, List.map Pos.unmark args) with | A.Binop A.And, [ ELit (LBool b1); ELit (LBool b2) ] -> A.ELit (LBool (b1 && b2)) | A.Binop A.Or, [ ELit (LBool b1); ELit (LBool b2) ] -> A.ELit (LBool (b1 || b2)) - | A.Binop A.Add, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.add i1 i2)) - | A.Binop A.Sub, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.sub i1 i2)) - | A.Binop A.Mult, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.mul i1 i2)) - | A.Binop A.Div, [ ELit (LInt i1); ELit (LInt i2) ] -> + | A.Binop (A.Add KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.add i1 i2)) + | A.Binop (A.Sub KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.sub i1 i2)) + | A.Binop (A.Mult KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LInt (Int64.mul i1 i2)) + | A.Binop (A.Div KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> if i2 <> Int64.zero then A.ELit (LInt (Int64.div i1 i2)) else Errors.raise_multispanned_error "division by zero at runtime" @@ -37,10 +37,10 @@ let evaluate_operator (op : A.operator Pos.marked) (args : A.expr Pos.marked lis (Some "The division operator:", Pos.get_position op); (Some "The null denominator:", Pos.get_position (List.nth args 2)); ] - | A.Binop A.Add, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.add i1 i2)) - | A.Binop A.Sub, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.sub i1 i2)) - | A.Binop A.Mult, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.mul i1 i2)) - | A.Binop A.Div, [ ELit (LRat i1); ELit (LRat i2) ] -> + | A.Binop (A.Add KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.add i1 i2)) + | A.Binop (A.Sub KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.sub i1 i2)) + | A.Binop (A.Mult KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LRat (Q.mul i1 i2)) + | A.Binop (A.Div KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> if i2 <> Q.zero then A.ELit (LRat (Q.div i1 i2)) else Errors.raise_multispanned_error "division by zero at runtime" @@ -48,24 +48,25 @@ let evaluate_operator (op : A.operator Pos.marked) (args : A.expr Pos.marked lis (Some "The division operator:", Pos.get_position op); (Some "The null denominator:", Pos.get_position (List.nth args 2)); ] - | A.Binop A.Lt, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 < i2)) - | A.Binop A.Lte, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 <= i2)) - | A.Binop A.Gt, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 > i2)) - | A.Binop A.Gte, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 >= i2)) - | A.Binop A.Eq, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 = i2)) - | A.Binop A.Lt, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 < i2)) - | A.Binop A.Lte, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 <= i2)) - | A.Binop A.Gt, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 > i2)) - | A.Binop A.Gte, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 >= i2)) + | A.Binop (A.Lt KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 < i2)) + | A.Binop (A.Lte KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 <= i2)) + | A.Binop (A.Gt KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 > i2)) + | A.Binop (A.Gte KInt), [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 >= i2)) + | A.Binop (A.Lt KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 < i2)) + | A.Binop (A.Lte KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 <= i2)) + | A.Binop (A.Gt KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 > i2)) + | A.Binop (A.Gte KRat), [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 >= i2)) | A.Binop A.Eq, [ ELit (LRat i1); ELit (LRat i2) ] -> A.ELit (LBool Q.(i1 = i2)) + | A.Binop A.Eq, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 = i2)) | A.Binop A.Eq, [ ELit (LBool b1); ELit (LBool b2) ] -> A.ELit (LBool (b1 = b2)) | A.Binop A.Eq, [ _; _ ] -> A.ELit (LBool false) (* comparing functions return false *) | A.Binop A.Neq, [ ELit (LInt i1); ELit (LInt i2) ] -> A.ELit (LBool (i1 <> i2)) | A.Binop A.Neq, [ ELit (LBool b1); ELit (LBool b2) ] -> A.ELit (LBool (b1 <> b2)) | A.Binop A.Neq, [ _; _ ] -> A.ELit (LBool true) | A.Binop _, ([ ELit LEmptyError; _ ] | [ _; ELit LEmptyError ]) -> A.ELit LEmptyError + | A.Unop (A.Minus KInt), [ ELit (LInt i) ] -> A.ELit (LInt (Int64.sub Int64.zero i)) + | A.Unop (A.Minus KRat), [ ELit (LRat i) ] -> A.ELit (LRat (Q.sub Q.zero i)) | A.Unop A.Not, [ ELit (LBool b) ] -> A.ELit (LBool (not b)) - | A.Unop A.Minus, [ ELit (LInt i) ] -> A.ELit (LInt (Int64.sub Int64.zero i)) | A.Unop A.ErrorOnEmpty, [ e' ] -> if e' = A.ELit LEmptyError then Errors.raise_spanned_error @@ -206,7 +207,9 @@ let empty_thunked_term : Ast.expr Pos.marked = (Ast.make_abs (Array.of_list [ silent ]) (Bindlib.box (Ast.ELit Ast.LEmptyError, Pos.no_pos)) - Pos.no_pos [ (Ast.TUnit, Pos.no_pos) ] Pos.no_pos) + Pos.no_pos + [ (Ast.TLit Ast.TUnit, Pos.no_pos) ] + Pos.no_pos) let interpret_program (e : Ast.expr Pos.marked) : (Ast.Var.t * Ast.expr Pos.marked) list = match Pos.unmark (evaluate_expr e) with diff --git a/src/catala/default_calculus/print.ml b/src/catala/default_calculus/print.ml index 67642cb9..b7788e39 100644 --- a/src/catala/default_calculus/print.ml +++ b/src/catala/default_calculus/print.ml @@ -24,10 +24,11 @@ let rec format_typ (fmt : Format.formatter) (typ : typ Pos.marked) : unit = else Format.fprintf fmt "%a" format_typ t in match Pos.unmark typ with - | TUnit -> Format.fprintf fmt "unit" - | TBool -> Format.fprintf fmt "bool" - | TInt -> Format.fprintf fmt "int" - | TRat -> Format.fprintf fmt "dec" + | TLit TUnit -> Format.fprintf fmt "unit" + | TLit TBool -> Format.fprintf fmt "bool" + | TLit TInt -> Format.fprintf fmt "int" + | TLit TRat -> Format.fprintf fmt "dec" + | TLit TMoney -> Format.fprintf fmt "money" | TTuple ts -> Format.fprintf fmt "(%a)" (Format.pp_print_list ~pp_sep:(fun fmt () -> Format.fprintf fmt " *@ ") format_typ) @@ -46,26 +47,27 @@ let format_lit (fmt : Format.formatter) (l : lit Pos.marked) : unit = | LEmptyError -> Format.fprintf fmt "∅" | LUnit -> Format.fprintf fmt "()" | LRat i -> Format.fprintf fmt "%f" (Q.to_float i) + | LMoney e -> Format.fprintf fmt "$%.2f" Q.(to_float (of_bigint e / of_int 100)) let format_binop (fmt : Format.formatter) (op : binop Pos.marked) : unit = Format.fprintf fmt "%s" ( match Pos.unmark op with - | Add -> "+" - | Sub -> "-" - | Mult -> "*" - | Div -> "/" + | Add _ -> "+" + | Sub _ -> "-" + | Mult _ -> "*" + | Div _ -> "/" | And -> "&&" | Or -> "||" | Eq -> "==" | Neq -> "!=" - | Lt -> "<" - | Lte -> "<=" - | Gt -> ">" - | Gte -> ">=" ) + | Lt _ -> "<" + | Lte _ -> "<=" + | Gt _ -> ">" + | Gte _ -> ">=" ) let format_unop (fmt : Format.formatter) (op : unop Pos.marked) : unit = Format.fprintf fmt "%s" - (match Pos.unmark op with Minus -> "-" | Not -> "~" | ErrorOnEmpty -> "error_on_empty") + (match Pos.unmark op with Minus _ -> "-" | Not -> "~" | ErrorOnEmpty -> "error_on_empty") let needs_parens (e : expr Pos.marked) : bool = match Pos.unmark e with EAbs _ -> true | _ -> false diff --git a/src/catala/default_calculus/typing.ml b/src/catala/default_calculus/typing.ml index ff83db5e..6663dd50 100644 --- a/src/catala/default_calculus/typing.ml +++ b/src/catala/default_calculus/typing.ml @@ -21,10 +21,7 @@ module A = Ast module Cli = Utils.Cli type typ = - | TUnit - | TInt - | TBool - | TRat + | TLit of A.typ_lit | TArrow of typ Pos.marked UnionFind.elem * typ Pos.marked UnionFind.elem | TTuple of typ Pos.marked UnionFind.elem list | TEnum of typ Pos.marked UnionFind.elem list @@ -33,10 +30,11 @@ type typ = let rec format_typ (fmt : Format.formatter) (ty : typ Pos.marked UnionFind.elem) : unit = let ty_repr = UnionFind.get (UnionFind.find ty) in match Pos.unmark ty_repr with - | TUnit -> Format.fprintf fmt "unit" - | TBool -> Format.fprintf fmt "bool" - | TInt -> Format.fprintf fmt "int" - | TRat -> Format.fprintf fmt "dec" + | TLit TUnit -> Format.fprintf fmt "unit" + | TLit TBool -> Format.fprintf fmt "bool" + | TLit TInt -> Format.fprintf fmt "int" + | TLit TRat -> Format.fprintf fmt "dec" + | TLit TMoney -> Format.fprintf fmt "money" | TAny -> Format.fprintf fmt "any type" | TTuple ts -> Format.fprintf fmt "(%a)" @@ -53,8 +51,7 @@ let rec unify (t1 : typ Pos.marked UnionFind.elem) (t2 : typ Pos.marked UnionFin let t1_repr = UnionFind.get (UnionFind.find t1) in let t2_repr = UnionFind.get (UnionFind.find t2) in match (t1_repr, t2_repr) with - | (TUnit, _), (TUnit, _) | (TBool, _), (TBool, _) | (TInt, _), (TInt, _) | (TRat, _), (TRat, _) -> - () + | (TLit tl1, _), (TLit tl2, _) when tl1 = tl2 -> () | (TArrow (t11, t12), _), (TArrow (t21, t22), _) -> unify t11 t21; unify t12 t22 @@ -68,8 +65,8 @@ let rec unify (t1 : typ Pos.marked UnionFind.elem) (t2 : typ Pos.marked UnionFin (* TODO: if we get weird error messages, then it means that we should use the persistent version of the union-find data structure. *) Errors.raise_multispanned_error - (Format.asprintf "Error during typechecking, type mismatch: cannot unify %a and %a" - format_typ t1 format_typ t2) + (Format.asprintf "Error during typechecking, types %a and %a are incompatible" format_typ t1 + format_typ t2) [ (Some (Format.asprintf "Type %a coming from expression:" format_typ t1), t1_pos); (Some (Format.asprintf "Type %a coming from expression:" format_typ t2), t2_pos); @@ -77,24 +74,30 @@ let rec unify (t1 : typ Pos.marked UnionFind.elem) (t2 : typ Pos.marked UnionFin let op_type (op : A.operator Pos.marked) : typ Pos.marked UnionFind.elem = let pos = Pos.get_position op in - let bt = UnionFind.make (TBool, pos) in + let bt = UnionFind.make (TLit TBool, pos) in + let it = UnionFind.make (TLit TInt, pos) in + let rt = UnionFind.make (TLit TRat, pos) in + let mt = UnionFind.make (TLit TMoney, pos) in let any = UnionFind.make (TAny, pos) in let arr x y = UnionFind.make (TArrow (x, y), pos) in match Pos.unmark op with | A.Binop (A.And | A.Or) -> arr bt (arr bt bt) - | A.Binop (A.Add | A.Sub | A.Mult | A.Div) -> arr any (arr any any) - | A.Binop (A.Lt | A.Lte | A.Gt | A.Gte) -> arr any (arr any bt) + | A.Binop (A.Add KInt | A.Sub KInt | A.Mult KInt | A.Div KInt) -> arr it (arr it it) + | A.Binop (A.Add KRat | A.Sub KRat | A.Mult KRat | A.Div KRat) -> arr rt (arr rt rt) + | A.Binop (A.Add KMoney | A.Sub KMoney | A.Mult KMoney | A.Div KMoney) -> arr mt (arr mt mt) + | A.Binop (A.Lt KInt | A.Lte KInt | A.Gt KInt | A.Gte KInt) -> arr it (arr it bt) + | A.Binop (A.Lt KRat | A.Lte KRat | A.Gt KRat | A.Gte KRat) -> arr rt (arr rt bt) + | A.Binop (A.Lt KMoney | A.Lte KMoney | A.Gt KMoney | A.Gte KMoney) -> arr mt (arr mt bt) | A.Binop (A.Eq | A.Neq) -> arr any (arr any bt) - | A.Unop A.Minus -> arr any any + | A.Unop (A.Minus KInt) -> arr it it + | A.Unop (A.Minus KRat) -> arr rt rt + | A.Unop (A.Minus KMoney) -> arr mt mt | A.Unop A.Not -> arr bt bt | A.Unop A.ErrorOnEmpty -> arr any any let rec ast_to_typ (ty : A.typ) : typ = match ty with - | A.TUnit -> TUnit - | A.TBool -> TBool - | A.TRat -> TRat - | A.TInt -> TInt + | A.TLit l -> TLit l | A.TArrow (t1, t2) -> TArrow ( UnionFind.make (Pos.map_under_mark ast_to_typ t1), @@ -106,14 +109,11 @@ let rec typ_to_ast (ty : typ Pos.marked UnionFind.elem) : A.typ Pos.marked = Pos.map_under_mark (fun ty -> match ty with - | TUnit -> A.TUnit - | TBool -> A.TBool - | TInt -> A.TInt - | TRat -> A.TRat + | TLit l -> A.TLit l | TTuple ts -> A.TTuple (List.map typ_to_ast ts) | TEnum ts -> A.TEnum (List.map typ_to_ast ts) | TArrow (t1, t2) -> A.TArrow (typ_to_ast t1, typ_to_ast t2) - | TAny -> A.TUnit) + | TAny -> A.TLit A.TUnit) (UnionFind.get (UnionFind.find ty)) type env = typ Pos.marked A.VarMap.t @@ -127,10 +127,11 @@ let rec typecheck_expr_bottom_up (env : env) (e : A.expr Pos.marked) : typ Pos.m | None -> Errors.raise_spanned_error "Variable not found in the current context" (Pos.get_position e) ) - | ELit (LBool _) -> UnionFind.make (Pos.same_pos_as TBool e) - | ELit (LInt _) -> UnionFind.make (Pos.same_pos_as TInt e) - | ELit (LRat _) -> UnionFind.make (Pos.same_pos_as TRat e) - | ELit LUnit -> UnionFind.make (Pos.same_pos_as TUnit e) + | ELit (LBool _) -> UnionFind.make (Pos.same_pos_as (TLit TBool) e) + | ELit (LInt _) -> UnionFind.make (Pos.same_pos_as (TLit TInt) e) + | ELit (LRat _) -> UnionFind.make (Pos.same_pos_as (TLit TRat) e) + | ELit (LMoney _) -> UnionFind.make (Pos.same_pos_as (TLit TMoney) e) + | ELit LUnit -> UnionFind.make (Pos.same_pos_as (TLit TUnit) e) | ELit LEmptyError -> UnionFind.make (Pos.same_pos_as TAny e) | ETuple es -> let ts = List.map (fun (e, _) -> typecheck_expr_bottom_up env e) es in @@ -209,12 +210,12 @@ let rec typecheck_expr_bottom_up (env : env) (e : A.expr Pos.marked) : typ Pos.m t_ret | EOp op -> op_type (Pos.same_pos_as op e) | EDefault (just, cons, subs) -> - typecheck_expr_top_down env just (UnionFind.make (Pos.same_pos_as TBool just)); + typecheck_expr_top_down env just (UnionFind.make (Pos.same_pos_as (TLit TBool) just)); let tcons = typecheck_expr_bottom_up env cons in List.iter (fun sub -> typecheck_expr_top_down env sub tcons) subs; tcons | EIfThenElse (cond, et, ef) -> - typecheck_expr_top_down env cond (UnionFind.make (Pos.same_pos_as TBool cond)); + typecheck_expr_top_down env cond (UnionFind.make (Pos.same_pos_as (TLit TBool) cond)); let tt = typecheck_expr_bottom_up env et in typecheck_expr_top_down env ef tt; tt @@ -228,10 +229,11 @@ and typecheck_expr_top_down (env : env) (e : A.expr Pos.marked) | None -> Errors.raise_spanned_error "Variable not found in the current context" (Pos.get_position e) ) - | ELit (LBool _) -> unify tau (UnionFind.make (Pos.same_pos_as TBool e)) - | ELit (LInt _) -> unify tau (UnionFind.make (Pos.same_pos_as TInt e)) - | ELit (LRat _) -> unify tau (UnionFind.make (Pos.same_pos_as TRat e)) - | ELit LUnit -> unify tau (UnionFind.make (Pos.same_pos_as TUnit e)) + | ELit (LBool _) -> unify tau (UnionFind.make (Pos.same_pos_as (TLit TBool) e)) + | ELit (LInt _) -> unify tau (UnionFind.make (Pos.same_pos_as (TLit TInt) e)) + | ELit (LRat _) -> unify tau (UnionFind.make (Pos.same_pos_as (TLit TRat) e)) + | ELit (LMoney _) -> unify tau (UnionFind.make (Pos.same_pos_as (TLit TMoney) e)) + | ELit LUnit -> unify tau (UnionFind.make (Pos.same_pos_as (TLit TUnit) e)) | ELit LEmptyError -> unify tau (UnionFind.make (Pos.same_pos_as TAny e)) | ETuple es -> ( let tau' = UnionFind.get (UnionFind.find tau) in @@ -333,11 +335,11 @@ and typecheck_expr_top_down (env : env) (e : A.expr Pos.marked) let op_typ = op_type (Pos.same_pos_as op e) in unify op_typ tau | EDefault (just, cons, subs) -> - typecheck_expr_top_down env just (UnionFind.make (Pos.same_pos_as TBool just)); + typecheck_expr_top_down env just (UnionFind.make (Pos.same_pos_as (TLit TBool) just)); typecheck_expr_top_down env cons tau; List.iter (fun sub -> typecheck_expr_top_down env sub tau) subs | EIfThenElse (cond, et, ef) -> - typecheck_expr_top_down env cond (UnionFind.make (Pos.same_pos_as TBool cond)); + typecheck_expr_top_down env cond (UnionFind.make (Pos.same_pos_as (TLit TBool) cond)); typecheck_expr_top_down env et tau; typecheck_expr_top_down env ef tau diff --git a/src/catala/scope_language/ast.ml b/src/catala/scope_language/ast.ml index e7b9530e..23dba6bf 100644 --- a/src/catala/scope_language/ast.ml +++ b/src/catala/scope_language/ast.ml @@ -65,10 +65,7 @@ module LocationSet = Set.Make (struct end) type typ = - | TBool - | TUnit - | TInt - | TRat + | TLit of Dcalc.Ast.typ_lit | TStruct of StructName.t | TEnum of EnumName.t | TArrow of typ Pos.marked * typ Pos.marked diff --git a/src/catala/scope_language/dependency.ml b/src/catala/scope_language/dependency.ml index 2bf425d2..d6e69f4c 100644 --- a/src/catala/scope_language/dependency.ml +++ b/src/catala/scope_language/dependency.ml @@ -149,7 +149,7 @@ let rec get_structs_or_enums_in_type (t : Ast.typ Pos.marked) : TVertexSet.t = | Ast.TEnum e -> TVertexSet.singleton (TVertex.Enum e) | Ast.TArrow (t1, t2) -> TVertexSet.union (get_structs_or_enums_in_type t1) (get_structs_or_enums_in_type t2) - | Ast.TBool | Ast.TUnit | Ast.TInt | Ast.TRat -> TVertexSet.empty + | Ast.TLit _ -> TVertexSet.empty let build_type_graph (structs : Ast.struct_ctx) (enums : Ast.enum_ctx) : TDependencies.t = let g = TDependencies.empty in diff --git a/src/catala/scope_language/print.ml b/src/catala/scope_language/print.ml index af036ac1..af240081 100644 --- a/src/catala/scope_language/print.ml +++ b/src/catala/scope_language/print.ml @@ -37,10 +37,11 @@ let rec format_typ (fmt : Format.formatter) (typ : typ Pos.marked) : unit = else Format.fprintf fmt "%a" format_typ t in match Pos.unmark typ with - | TUnit -> Format.fprintf fmt "unit" - | TBool -> Format.fprintf fmt "bool" - | TInt -> Format.fprintf fmt "int" - | TRat -> Format.fprintf fmt "dec" + | TLit TUnit -> Format.fprintf fmt "unit" + | TLit TBool -> Format.fprintf fmt "bool" + | TLit TInt -> Format.fprintf fmt "int" + | TLit TRat -> Format.fprintf fmt "dec" + | TLit TMoney -> Format.fprintf fmt "money" | TStruct s -> Format.fprintf fmt "%a" Ast.StructName.format_t s | TEnum e -> Format.fprintf fmt "%a" Ast.EnumName.format_t e | TArrow (t1, t2) -> diff --git a/src/catala/scope_language/scope_to_dcalc.ml b/src/catala/scope_language/scope_to_dcalc.ml index 764f8762..58e77c24 100644 --- a/src/catala/scope_language/scope_to_dcalc.ml +++ b/src/catala/scope_language/scope_to_dcalc.ml @@ -45,10 +45,7 @@ let hole_var : Dcalc.Ast.Var.t = Dcalc.Ast.Var.make ("·", Pos.no_pos) let rec translate_typ (ctx : ctx) (t : Ast.typ Pos.marked) : Dcalc.Ast.typ Pos.marked = Pos.same_pos_as ( match Pos.unmark t with - | Ast.TUnit -> Dcalc.Ast.TUnit - | Ast.TBool -> Dcalc.Ast.TBool - | Ast.TInt -> Dcalc.Ast.TInt - | Ast.TRat -> Dcalc.Ast.TRat + | Ast.TLit l -> Dcalc.Ast.TLit l | Ast.TArrow (t1, t2) -> Dcalc.Ast.TArrow (translate_typ ctx t1, translate_typ ctx t2) | Ast.TStruct s_uid -> let s_fields = Ast.StructMap.find s_uid ctx.structs in @@ -299,7 +296,7 @@ let rec translate_rule (ctx : ctx) (rule : Ast.rule) (rest : Ast.rule list) (pos Dcalc.Ast.make_abs (Array.of_list [ Pos.unmark a_var ]) next_e var_def_pos - [ (Dcalc.Ast.TArrow ((TUnit, var_def_pos), tau), var_def_pos) ] + [ (Dcalc.Ast.TArrow ((TLit TUnit, var_def_pos), tau), var_def_pos) ] (Pos.get_position e) in let new_e = translate_expr ctx e in @@ -308,7 +305,7 @@ let rec translate_rule (ctx : ctx) (rule : Ast.rule) (rest : Ast.rule list) (pos Dcalc.Ast.make_abs (Array.of_list [ silent_var ]) new_e var_def_pos - [ (Dcalc.Ast.TUnit, var_def_pos) ] + [ (Dcalc.Ast.TLit TUnit, var_def_pos) ] var_def_pos in let out_e = Dcalc.Ast.make_app intermediate_e [ thunked_new_e ] (Pos.get_position e) in @@ -416,7 +413,7 @@ let translate_scope_decl (struct_ctx : Ast.struct_ctx) (enum_ctx : Ast.enum_ctx) rules pos_sigma (List.map (fun (_, tau, _) -> - (Dcalc.Ast.TArrow ((Dcalc.Ast.TUnit, pos_sigma), (tau, pos_sigma)), pos_sigma)) + (Dcalc.Ast.TArrow ((Dcalc.Ast.TLit TUnit, pos_sigma), (tau, pos_sigma)), pos_sigma)) scope_variables) pos_sigma @@ -425,7 +422,7 @@ let build_scope_typ_from_sig (scope_sig : (Ast.ScopeVar.t * Dcalc.Ast.typ) list) let result_typ = (Dcalc.Ast.TTuple (List.map (fun (_, tau) -> (tau, pos)) scope_sig), pos) in List.fold_right (fun (_, arg_t) acc -> - (Dcalc.Ast.TArrow ((Dcalc.Ast.TArrow ((TUnit, pos), (arg_t, pos)), pos), acc), pos)) + (Dcalc.Ast.TArrow ((Dcalc.Ast.TArrow ((TLit TUnit, pos), (arg_t, pos)), pos), acc), pos)) scope_sig result_typ let translate_program (prgm : Ast.program) (top_level_scope_name : Ast.ScopeName.t) : diff --git a/tests/test_dec/simple.catala b/tests/test_dec/simple.catala index e7a907a8..382c7bd3 100644 --- a/tests/test_dec/simple.catala +++ b/tests/test_dec/simple.catala @@ -9,5 +9,5 @@ new scope A: scope A: def x := 84.648665 def y := 4.368297 - def z := x / y + def z := x /. y */ \ No newline at end of file