forked from powdr-labs/powdr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT support for match expressions. (powdr-labs#1838)
This PR supports match expression, while most of the work regards patterns. Unfortunately, we cannot use rust patterns directly: The types are too incompatible. For example a `match ("abc", 7) { ("abc", 7) => ...}` cannot be directly translated, since the rust types here are `String` and `ibig::IBig` and they cannot be used with these literals like that, at least not directly and in all circumstances. The way it is implemented here is that each pattern is compiled to code that is supposed to evaluate to an Option. If the pattern matches, the Option is a Some-value that contains the values that are assigned to the variables in the pattern. The function also returns a string containing the variable names. The function calls itself recursively on recursive data structures. --------- Co-authored-by: Gastón Zanitti <[email protected]> Co-authored-by: Georg Wiese <[email protected]>
- Loading branch information
1 parent
990d357
commit eebbe5f
Showing
2 changed files
with
219 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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