Open
Conversation
feat: add position to yaml scalar
* Output logs without interupting compilation * Add warning for orphan rules
* feat: prepare adding type info to eval ast * feat: add type_database * feat: first version of type inference * wip * feat: type check return error with position
* feat: add cycle check * wipp * Add parameter computation
Refactors the evaluation system by replacing direct `evaluate` function with a properly typed Engine class that supports context parameters. Renames `evaluate` to `evaluateNode` and updates all relevant tests and interfaces.
Convert compilation pipeline to produce TypeScript output, restructuring the evaluation tree and type checking system for better modularity. Changed position handling to use named parameters for clarity.
* Add support for sum mechanism in Publicodes compiler Refactor parsing components to better handle expressions and add sum support: - Rename expressions directory to expr - Extract mechanism parsing logic into separate file - Extend AST to support Sum nodes - Improve error handling in lexer and parser - Fix pass numbering in main compiler flow * Add product and logical operations to compiler Implement new mechanisms: - produit - toutes ces conditions - une de ces conditions Update parser, resolver, type checker and code generator to handle these new operations. * Enforce single mechanism at the same indentation level in parser * Add duplicate YAML key detection and handling
Add support for mechanisms in Publicodes compiler --- Refactor parsing components to better handle expressions and add sum support: - Rename expressions directory to expr - Extract mechanism parsing logic into separate file - Extend AST to support Sum nodes - Improve error handling in lexer and parser - Fix pass numbering in main compiler flow * Add product and logical operations to compiler Implement new mechanisms: - produit - toutes ces conditions - une de ces conditions Update parser, resolver, type checker and code generator to handle these new operations. * Enforce single mechanism at the same indentation level in parser * Add duplicate YAML key detection and handling * Refactor AST to support more mechanisms Rename constructors for consistency (BinaryOp→Binary_op, AnyOf→One_of) Add new value types: Applicable_if, Not_applicable_if, Ceiling, Floor Replace parse_mechanism with parse_value for better structure Improve position handling in AST with naked_value type Rename from_list to all_keep_logs for clarity * Refactor AST to separate value and chainable mechanisms Add a new structure where values have a list of chainable mechanisms that are applied in order, rather than having them nested. This makes the AST more consistent and the code more maintainable. * Uncomment parser code and add chainable mechanisms tests Update test assertions to work with new value structure containing chainable mechanisms. Change p function to require length parameter. * Remove parser utility functions * Fix type checking for conditional expressions Ensure condition is Bool type and result type matches branch type. Make pattern matching more explicit for Undefined and Null cases.
31aef23 to
d6e12cb
Compare
* feat(compiler): naive compilation to javascript * feat(compiler): iterate on js compilation * feat(compiler): generate .d.ts files * feat(compiler): start to implement a runtime + add cache layer to the js engine * feat(compiler): benchmark with first minimal runtime * fix(compiler): correctly manage contexte and constants * feat(compiler): allows to compile to js or json + start to debug the JS backend * feat(runtime): allow to run tests with compiled to js code * refactor(runtime): use public getters on outputs data * fix(compiler): use the neq runtime and start to fix the ternary conditionnal * fix(compiler): fix the js runtime semantic + add dune rule to embed js file in ocaml module * fix(compiler): use default output file according the output type extension * fix(compiler): fix the JS runtime round() function to have the correct precision * fix(runtime): refactor tests * fix(runtime): add the bun in dev deps * fix(runtime): update auto-entrepreneur benchmark - Everything is recompiled before running benchmark. - Add support to the JS compiled engine. - Check return values with assert in the benchmark to track regression (note: the legacy engine doesn't return the same results as the new ones, is it wanted?) * refactor(runtime): remove unused benchmark file * fix(compiler): start to fix parameters problem in JS compilation And add dedicated test in the runtime specs to track regressions * fix(compiler): remove artefacts * feat(compiler): correctly handle needed/missing parameters with context in the JS compilation * fix(compiler): correctly escape " from constant * fix(compiler): correctly manage floor and ceiling tranformation * fix(compiler): correctly manage lazy operators on null values * feat(runtime): add more test for paramters * feat(compiler): try a compilation to pure JS functions * feat(runtime): improve the parameters handling -> better perfs * fix(compiler): correctly manage ref in the JSON output * fix(compiler): correctly parse emtpy string + add test for `par défaut` mechanism * fix(compiler): correctly handle 'toutes ces conditions' with only one arguement * fix(compiler): prefixes with $ runtime function to avoid name collision * feat(compiler): expriment with js optim * feat(compiler): export JS rules in a dedicated object * feat(compiler): add cache for refs in the JS runtime * feat(compiler): add missing JSDoc types in the javascript runtime * refactor(compiler): add comment to the optim module * feat(compiler): generates JSDoc types * refactor(compiler): remove the JSON output as we only compile to JS now * refactor(compiler): move To_hash as Tree.Hash + add some .mli files * Add test and improve generated JS (#782) * test: add test for context mechanism * test: repare test for arrondi * test: arrondi et applicable si * test: applicable si / non applicable si / plafond / plancher * test: par défaut * test: add date * feat: improve generated JS 1. Change rule signature to an object containing « evaluate » function This allows to add other meta (title, type, unit, description, etc) at the same place of the rule, and simplifies the API. 2. Improve generated JSDoc Use proper typing for param object 3. Add / update test Add some test, and update the previous ones * fix: date equality comparison * feat: fix js output * fix: equality implementation * test: add test for equality * feat: add global cache and cleaning * fix(compiler): avoid conflits with javascript identifiers * refactor(compiler): use Pp instead of sprintf for the to_js module * remove @publicodes/runtime package - Move test and benchmark to compiler - Create separate JS private package for each of theù * fix JSDoc generation * fix tests --------- Co-authored-by: Emile Rolley <[email protected]>
direnv is good and safe enough to use
The model has been renamed to missing_terme.publicodes, breaking this test.
This one was just needing a promote?
Now I think the trailing "-" is the error. The stdout ends with a stdin error, and the CI fails harder. Remove this.
Currently the tests are not re-run on binary change. This dependency on the built binary was only used for this directory. Using :whole_subtree make it recursive.
Odoc only build documentation for public libraries. We have to specify public_name for odoc to consider them.
This add a -c command argument to pass a config file path. This allow the user to specify multiple compilation targets. A default value "publicodes.yaml" is used when absent. If both inputs files, and config file are given by the user, the config file is ignored. Currently the watch mode is not supported when building multiple targets. An error message is displayed to the user for now. The yaml format is simple, and specify the build targets: targets: - output: test.js.local inputs: - test.publicodes.local type: js default_to_public: false All fields are checked, and a corresponding error message is build to the notice the user on invalid format. Ex: Error: Parsing config: "targets" field error: "inputs" field error: Expected a string value Co-authored-by: Emile Rolley <[email protected]>
The init subcommand generate and write a default configuration file. Co-authored-by: Emile Rolley <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Soon...
👉 Voir l'avancement : Publicodes 2