Commit Graph
30 Commits
Author SHA1 Message Date
Benjamin_Loison 9fbdb7000f Merge branch 'ast2C_proposition' of https://gitea.lemnoslife.com/Benjamin_Loison/Synchronous_reactive_systems into ast2C_proposition 2022-12-20 03:51:31 +01:00
Benjamin_Loison e1de3e6829 Add support for resets 2022-12-20 03:51:28 +01:00
Benjamin_Loison 657fe7e6fa Add support for resets 2022-12-20 03:48:37 +01:00
Benjamin_Loison 025d25a146 Replace nunmbers to numbers in two comments of src/parser.mly 2022-12-19 19:48:21 +01:00
Benjamin_Loison 9a0bfd468c Correct some typos 2022-12-19 14:06:18 +01:00
Benjamin_Loison 609870755c Remove debugging symbols in failwith
As running `OCAMLRUNPARAM=b ./_build/main.native ...` provides in case of `failwith` a better stacktrace.
This enables moving `failwith`s from a file to the other without adapting them.
2022-12-19 13:56:48 +01:00
Benjamin_Loison 02130cf57c Rename maybeprint to print_if_any to precise the purpose of this function 2022-12-18 14:50:55 +01:00
Benjamin_Loison 273a868162 Simplify cp_value for boolean constants in src/cprint.ml 2022-12-18 14:45:23 +01:00
Benjamin_Loison 37dfcdda35 Remove unneeded node prototypes, as Lustre only allows to call already defined nodes 2022-12-18 14:42:26 +01:00
Benjamin_Loison c3a64a2bae Correct some typos 2022-12-18 14:31:56 +01:00
Benjamin_Loison 298e88f1a5 Simplify ETriOp case in src/ast_to_c.ml 2022-12-11 22:25:11 +01:00
Benjamin_Loison 014110791d Remove useless prefix from pp_expression_aux and pp_expression_list functions in src/ast_to_c.ml 2022-12-11 20:07:28 +01:00
Benjamin_Loison cbddd63927 Format the code to make it shorter and more readable 2022-12-11 19:53:23 +01:00
Benjamin_Loison 241f3dcbc0 Add pre support in C 2022-12-11 19:28:41 +01:00
Benjamin_Loison c0c29e1df7 Add assignement support for tuples 2022-12-11 18:45:30 +01:00
Benjamin_Loison da823ac3c8 Add -> support in C 2022-12-10 21:17:32 +01:00
Benjamin_Loison 38f58f7558 Unitfy pp_varlist, pp_argvarlist and pp_decvarlist 2022-12-10 20:51:52 +01:00
Benjamin_Loison eac8c6893c Add support to multiple local variables in C 2022-12-10 20:30:32 +01:00
Benjamin_Loison 363f5043a0 Add node call support in C 2022-12-10 20:22:11 +01:00
Benjamin_Loison 5a54f897b1 Add indentation to pp_equations in src/ast_to_c.ml 2022-12-10 19:27:18 +01:00
Benjamin_Loison ac1eea42e9 Make <=, >= and <> work 2022-12-10 19:24:34 +01:00
Benjamin_Loison a44c9288f5 Translate two expressions of the AST from French to English 2022-12-10 19:12:16 +01:00
Benjamin_Loison b2e3ec4dd8 Modify src/ast_to_c.ml as a first iteration 2022-12-10 19:07:18 +01:00
Benjamin_Loison a8e89854a4 Copy src/pp.ml to src/ast_to_c and modify src/main.ml accordingly
Just `pp_ast` was renamed to `ast_to_c`.
2022-12-10 18:58:06 +01:00
Benjamin_Loison 45d64f6960 Add reset keyword 2022-12-10 02:18:04 +01:00
Benjamin_Loison dcf7320c0d Add one-line comment support and make some semi-column optional
Make possible the parsing of the counting example of *Clock-directed Modular Code Generation for Synchronous Data-flow Languages* (https://www.di.ens.fr/~pouzet/bib/lctes08a.pdf).

```
-- count the number of top between two tick
node counting (tick:bool; top:bool)
returns (o: int)
var v: int;
let o = if tick then v else 0 -> pre o + v;
    v = if top then 1 else 0;
tel;
```

The one-line comment rule was inspired from https://mukulrathi.com/create-your-own-programming-language/parsing-ocamllex-menhir/. Note their typo using `single_line_comment` instead of `read_single_line_comment`.
2022-12-10 01:58:09 +01:00
Benjamin_Loison 97930ba85c Correcting typos and using only English 2022-12-10 00:53:20 +01:00
Benjamin_Loison a17b3c6fdd 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.
2022-12-10 00:05:07 +01:00
Benjamin_Loison da1406fbcc Precise varlist types in the AST 2022-12-09 23:43:56 +01:00
Benjamin_Loison e9dd3fbde4 Add FBY instruction 2022-12-09 22:56:51 +01:00