Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order definitions via a dependency graph #93

Closed
SebastienGllmt opened this issue Sep 3, 2022 · 1 comment · Fixed by #103
Closed

Order definitions via a dependency graph #93

SebastienGllmt opened this issue Sep 3, 2022 · 1 comment · Fixed by #103
Labels
CDDL feature Feature that is required for proper parsing of CDDL files

Comments

@SebastienGllmt
Copy link
Collaborator

Currently, we parse rules as they come doing multiple passes. It would be nice if we instead generated a dependency graph of rules and then parsed rules based on this graph

@SebastienGllmt SebastienGllmt added the CDDL feature Feature that is required for proper parsing of CDDL files label Sep 3, 2022
@rooooooooob
Copy link
Collaborator

rooooooooob commented Sep 3, 2022

We'll need to handle cycles for recursive types in some way e.g. plutus_data which references plutus_list which references plutus_data. IIRC how it is now we need to hand edit it due to the const variant (since it contains a single datum which leads to undefined type sizes in rust) by making it a box but it's fine for maps/lists since those are already normally heap allocated.

rooooooooob added a commit that referenced this issue Oct 6, 2022
Fixes #93

This is extra important with multi file support now, as it can be
impossible in some cases to order things properly when the circular
dependencies were across multiple files. Now `babbage.cddl` processes
totally fine even when separated across many files.

This commit also includes some fixes for multi file support with
inter-file dependencies (e.g. fixes for visibility/module use/etc).
SebastienGllmt pushed a commit that referenced this issue Oct 19, 2022
* Multi-file support

For generating larger projects it may be desirable to generate into
different files. Now --input can take a directory. If it is given a
directory it will read all .cddl files and generate each in its own .rs
file for export. Serialization/*Encodings are still all in one file.

* Multi-file fix for cddl lib parsing errors

cddl doesn't support parsing incomplete cddl strings so will error
on some inputs. This works around it by merging it into 1 file with
scope markers then using those instead to mark scope.

* Dependency graph ordering of rules

Fixes #93

This is extra important with multi file support now, as it can be
impossible in some cases to order things properly when the circular
dependencies were across multiple files. Now `babbage.cddl` processes
totally fine even when separated across many files.

This commit also includes some fixes for multi file support with
inter-file dependencies (e.g. fixes for visibility/module use/etc).

* removing useless code in intermediate form creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDDL feature Feature that is required for proper parsing of CDDL files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants