Commit Graph

206 Commits

Author SHA1 Message Date
microproofs
e8f74985d5 Start working on using a decision tree for when expr. Also fmt fix 2024-10-08 13:30:29 -04:00
microproofs
5fe6e3f77b Finish simplification changes 2024-10-01 15:57:54 -04:00
microproofs
c6c5cddead Fix ordering of params on standard functions 2024-10-01 13:32:27 -04:00
microproofs
2bbc699a25 Refactor some code to make a define_const AirTree function 2024-10-01 13:32:27 -04:00
microproofs
16e222e997 Clippy fixes 2024-09-12 19:34:40 -04:00
microproofs
3f2de2665d Clippy fixes 2024-09-12 19:13:31 -04:00
microproofs
362ca2544f Fixed remaining issue when all parameters passed in to a recursive function were static.
Also fixed issue where modifying the calls in the airtree lead to an out of bounds index.
2024-09-12 17:03:48 -04:00
microproofs
7c52094b15 Making progress on using interning in gen_uplc
Done interning for uniqueness. Now to fix the static optimization

Remove unused function

Fixing issues. Have a few remaining tests
2024-09-12 17:03:36 -04:00
KtorZ
6a438bc8cd Fix missing locations from generated handler code. 2024-09-03 16:21:53 -04:00
microproofs
a6bc0f7157 Fix positioning on unwrap_void 2024-09-03 16:21:53 -04:00
microproofs
2be76d7cda Use Delay error directly when casting from data without traces 2024-09-03 16:21:53 -04:00
KtorZ
cd0a9440e8 Allow any expression as constants
This is only a start. It compiles, but with a few TODOs left open. In particular, it doesn't currently handle constants depending on other constants or functions; nor does it hoist constants.
2024-08-29 16:24:12 +02:00
KtorZ
7ec3f2e8df DRY builtins types creation to ensure proper consistency. 2024-08-25 16:20:06 +02:00
microproofs
72059eacee Fix: Recursion issue where the static param optimization on recursive functions that were passed as arguments to other functions 2024-08-08 19:36:16 -04:00
microproofs
56ff4ec678 Fixing other tests 2024-08-08 00:39:44 -04:00
microproofs
33370b8637 Fix minor issues found when testing 2024-08-08 00:39:44 -04:00
KtorZ
f5c4e185d4 Redact compiledCode & hash in generated blueprint tests
The point of those tests is to ensure that blueprints are generated
  properly, irrespective of the generated code. It is annoying to
  constantly get those test failing every time we introduce an
  optimization or something that would slightly change the generated
  UPLC.
2024-08-08 00:39:44 -04:00
microproofs
8a461d5bd5 Few minor changes, clippy fixes, and test fixes 2024-08-08 00:39:44 -04:00
microproofs
4cf81a19b1 Update most of the tests and builder functions to use the new delay_branch_functions 2024-08-08 00:39:44 -04:00
microproofs
d7e9fef4d3 Create new helper functions to take care of force and delaying branch terms 2024-08-08 00:39:44 -04:00
KtorZ
23a3134642 Rework choose_data_xxx API to include force/delay inside functions. 2024-08-08 00:39:44 -04:00
KtorZ
021679b8ac Force unwrap_xxx_or inside function body
Otherwise, it becomes the responsibility of the caller to force the result; which may be easily forgotten.
2024-08-08 00:39:44 -04:00
microproofs
a132a2e486 Fix unwrap issues 2024-08-08 00:39:44 -04:00
KtorZ
aefbc6e1b9 Define a safer API for unwrap_xxx_or and choose_data_xxx
Cloning a 'Term' is potentially dangerous, so we don't want this to
  happen by mistake. So instead, we pass in var names and turn them into
  terms when necessary.
2024-08-08 00:39:44 -04:00
KtorZ
9610237616 Refactor unknown_data_to_type, break down into smaller functions. 2024-08-08 00:39:44 -04:00
KtorZ
c3a61706b5 Factor out common UPLC logic for converting Data to Bool. 2024-08-08 00:39:44 -04:00
microproofs
05504b9762 Fix out of order expect check. Also fix no_inline error in code gen. @acceptance_107 2024-08-08 00:39:44 -04:00
microproofs
0be5229f1c Only 2 errors and todos left to finish 2024-08-08 00:39:44 -04:00
microproofs
dd5badd884 Start work on revamping assignment so we can handle soft casting properly 2024-08-08 00:39:44 -04:00
KtorZ
f14dfdf8e1 Allow pattern-matching on bytearrays
- Doesn't allow pattern-matching on G1/G2 elements and strings,
    because the use cases for those is unclear and it adds complexity to
    the feature.

  - We still _parse_ patterns on G1/G2 elements and strings, but emit an
    error in those cases.

  - The syntax is the same as for bytearray literals (i.e. supports hex,
    utf-8 strings or plain arrays of bytes).
2024-08-03 13:51:36 +02:00
KtorZ
1c58da4d86 Support mk_cons builtin
While this builtin is readily available through the Aiken syntax
  `[head, ..tail]`, there's no reason to not support its builtin form
  even though we may not encourage its usage. For completeness and to
  avoid bad surprises, it is now supported.

  Fixes #964.
2024-08-02 00:17:16 -04:00
KtorZ
bf5a406ffb Remove clause guards.
Closes #886.
2024-08-02 00:16:27 -04:00
microproofs
dfce9c1d96 feat: Add multivalidator as an AIR tree opcode.
feat: Add uplc eval optimization
2024-07-24 10:00:08 -04:00
microproofs
f1cfc84e67 Fix tree traversal node selection for a few of the enum variants 2024-06-25 18:50:00 -04:00
microproofs
4bd9125b86 Fix delay of arguments to be exactly the same as codegen tests 2024-06-25 18:50:00 -04:00
microproofs
f695276bf7 Fix codegen tree traversal to be updated for the otherwise field and future proof the traversal function 2024-06-25 18:50:00 -04:00
microproofs
cc9df04093 Fix missing delay in list_access_to_uplc. Also fix one of the unit tests. 2024-06-25 18:50:00 -04:00
microproofs
41b941e0e3 Fix castfromData in record access cases 2024-06-25 18:50:00 -04:00
microproofs
e09f6bbc87 delay otherwise branch to prevent premature errors 2024-06-25 18:50:00 -04:00
microproofs
df939e20ce missed a Air Op Code and updated how we pass in otherwise for assignment 2024-06-25 18:50:00 -04:00
rvcas
5024bd3f9c feat: code gen support for if/is
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2024-06-25 18:50:00 -04:00
KtorZ
c48f15a957 revert #903 'feat: Emit keyword'
While we agree on the idea of having some ways of emitting events, the
  design hasn't been completely fleshed out and it is unclear whether
  events should have a well-defined format independent of the framework
  / compiler and what this format should be.

  So we need more time discussing and agreeing about what use case we
  are actually trying to solve with that.

  Irrespective of that, some cleanup was also needed on the UPLC side
  anyway since the PR introduced a lot of needless duplications.
2024-05-23 17:22:12 +02:00
microproofs
fc0e88018e Chore:
Refactor get_uplc_type to account for constr types that don't exactly resolve to a uplc type
Check arg_stack in uplc generator has only 1 argument at the end of the generation
warning fixes
2024-05-04 14:04:12 -04:00
microproofs
ebe415cfc9 fix errors 2024-05-04 14:04:12 -04:00
KtorZ
91a7e77ab4 Add 'Pair' pattern and rework internals to use it.
Currently, pattern-matching on 'Pair' is handled by treating Pair as a
  record, which comes as slightly odd given that it isn't actually a
  record and isn't user-defined. Thus now, every use of a record must
  distinguish between Pairs and other kind of records -- which screams
  for another variant constructor instead.

  We cannot use `Tuple` either for this, because then we have no ways to
  tell 2-tuples apart from pairs, which is the whole point here. So the
  most sensical thing to do is to define a new pattern `Pair` which is
  akin to tuples, but simpler since we know the number of elements and
  it's always 2.
2024-05-04 14:04:12 -04:00
microproofs
75b076552c feat: Do a major overhaul on how we check types to allow for match patterns instead of if statements
Also fix one more test
2024-05-04 14:04:12 -04:00
microproofs
3c332ca42a Few more places in codegen where we need to be able to deal with Pair records 2024-05-04 14:04:12 -04:00
microproofs
26f68c2fb4 fix: found various unify and type issues while running tests 2024-05-04 14:04:12 -04:00
microproofs
21b60896f0 remove wild card match from tree functions
Start working on supporting Pair clauses
2024-05-04 14:04:12 -04:00
microproofs
f950ae7d3d WIP: add new opcodes to Air and AirTree and update parts of codegen to handle the new pair type 2024-05-04 14:04:12 -04:00