From a17b3c6fddd8dc4634d8842c3a4136a8ca0da35f Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Sat, 10 Dec 2022 00:05:07 +0100 Subject: [PATCH] Make `real` type works Otherwise for the following code: ``` node test (i: real) returns (o: real); let o = 0.0; tel ``` was experiencing: ``` Fatal error: exception Stdlib.Parsing.Parse_error Raised at Stdlib__Parsing.yyparse.loop in file "parsing.ml", line 139, characters 8-25 Called from Stdlib__Parsing.yyparse in file "parsing.ml", line 165, characters 4-28 Re-raised at Stdlib__Parsing.yyparse in file "parsing.ml", line 184, characters 8-17 Called from Parser.main in file "parser.ml" (inlined), line 1110, characters 4-44 Called from Main in file "main.ml", line 70, characters 16-68 ``` Note that `%token REAL` doesn't help to solve this error, but it doesn't seem to be any reason for not having it. --- src/lexer.mll | 1 + src/parser.mly | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lexer.mll b/src/lexer.mll index 3fda6ca..228ae81 100644 --- a/src/lexer.mll +++ b/src/lexer.mll @@ -14,6 +14,7 @@ ("returns", RETURNS); ("var", VAR); ("int", TYP(Ast.TInt)); + ("real", TYP(Ast.TReal)); ("bool", TYP(Ast.TBool)); ("<=", CMP_le); (">=", CMP_ge); diff --git a/src/parser.mly b/src/parser.mly index ed84534..d179369 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -118,6 +118,7 @@ %token COLON %token BOOL %token INT +%token REAL %token LET %token TEL %token NODE