Commit Graph

57 Commits

Author SHA1 Message Date
rvcas 589bb9a4b3
chore: change how we depend on pallas 2024-01-24 21:26:48 -05:00
Niels Mündler 0ae631a1fe Fix parsing Constr PlutusData 2024-01-13 13:23:58 -05:00
Niels Mündler 89e518f878 Deduplicate code 2023-12-19 12:20:10 -05:00
Niels Mündler 1b1636ab0e Fix parsing of negative bigint 2023-12-19 12:20:10 -05:00
Niels Mündler 0cfcd78039 Use more clear functions 2023-12-15 21:59:57 -05:00
Niels Mündler ceb6d63e95 Add parsing for big builtins 2023-12-15 21:59:57 -05:00
Niels Mündler b25e82ed36 Handle errors and format 2023-12-08 12:19:22 -05:00
Niels Mündler 772e73ae48 Fix parsing of hex encoded escaped bytes 2023-12-08 12:19:22 -05:00
microproofs 1567e42875 chore: fill in machine todos and cost model for case and constr
This allows for several more tests to pass
**Had to remove case-7 since it was incorrectly passing before**
2023-11-17 19:52:03 -05:00
rvcas 308fb47e40 fix: don't panic on invalid hex strings 2023-11-15 15:55:56 -05:00
rvcas 3f8f624a7b fix(uplc): more whitespace characters 2023-11-15 15:55:56 -05:00
rvcas 58d98b3325 fix(uplc): parser should accept single quote in var name and comments 2023-11-15 15:55:56 -05:00
rvcas 90aea6476a feat: uplc g1 and g2 literal parsing 2023-11-15 15:55:56 -05:00
microproofs 819a0a20e6 add tests for case and constr
Fix a minor issue with decoding order
2023-09-03 11:52:49 -04:00
microproofs e566c4e1de feat(uplc): add Case and Const terms
- parsering
- interning
- flat encoding and decoding
- pretty printing
- debruijn conversion

Co-authored-by: Lucas Rosa <x@rvcas.dev>
2023-09-03 11:52:49 -04:00
rvcas fb967d4c7b
fix: uplc formatter of Data closes #716 2023-08-31 17:20:48 -04:00
rvcas be7a441205
fix(uplc): pair type formatting closes #680 2023-07-19 13:49:05 -04:00
Pi Lanningham 189150612c cargo fmt :| 2023-07-09 23:16:01 -04:00
Pi Lanningham 26a4c57805 Clippy cleanup 2023-07-09 23:16:01 -04:00
Pi Lanningham c4690c6e00 Data parsing, tests 2023-07-09 23:16:01 -04:00
Pi Lanningham 6d9a95ef2d Add all but data parsing
Updates the parsing to the standard, *except* for Data, since that'll be more involved
2023-07-09 23:16:01 -04:00
rvcas 8a7df7f66b
test: add empty list test 2023-07-04 17:19:29 -04:00
KtorZ 057102c491
Add function to uplc::parser for string escape
Was originally written as a way to fix a failing property test on the
  program_builder; but the program builder is now gone. This function
  is still useful to have around.
2023-04-05 14:27:20 +02:00
KtorZ 1d3315005c
Support some single-character escape sequences in UPLC
Fixes #472.

  This also partially addresses #195. However, as pointed out in one of
  the comment, there's no 'official rule' when it comes to what should
  be considered valid escape sequences. Haskell relies mostly on the
  AttoParsec library and Rust also has its own set of rules.

  This is in particular true for unicode escape sequences, but there is
  a common middleground for some usual single character escapes such as
  \n or \\. So we now at least support these.

  For more complicated escape sequence, please refer to #195 for now and
  keep the discussion going there.
2023-03-30 11:50:59 +02:00
rvcas c1d67e95e1
feat: fix errors and add tests for BigInt changes 2023-02-09 15:01:30 -05:00
KtorZ e76d26eb3c
Fixup: follow compiler. 2023-02-09 16:09:49 +01:00
rvcas c8efe60843 feat: use Rc for more things, fib_iter runs almost 3 seconds faster now 2023-02-01 18:53:11 -05:00
rvcas b3266fb837 chore: clippy warnings 2022-12-20 16:32:31 -05:00
KtorZ 375499930a Add UPLC support for 'ProtoList' & 'ProtoPair' constants
Supersedes #35.

  The syntax for these elements isn't "set in stone"; in the sense that it is unspecified in [input-output-hk/plutus](https://github.com/input-output-hk/plutus). There's no visible plan from IOG to extend the Haskell parser to support this syntax, though there are samples of imagined syntax in the code. Thus, we can lead the way and simply choose a suitable syntax and let the Haskell implementation align to it later.

  This syntax is thus inspired from input-output-hk/plutus' samples, with only a small change: we use `<` and `>` for encapsulating type declaration instead of `(`, `)`. There are already enough parentheses in the UPLC syntax, adding more reduces visibility.

  Doing this, I've also added a lot more test cases for the UPLC parser. There could be more, but this is a good start.

  Here are some example programs (taken from test cases) utilizing this syntax:

  ```
  (program 0.0.0 (con list<bytestring> [#00, #01]))
  ```

  ```
  (program 0.0.0
      (con pair
        <integer, integer>
        [14, 42]
      )
  )
  ```

  ```
  (program 0.0.0
      (con pair<string, list<integer>> ["foo", [14, 42]])
  )
  ```

  _(Note that this was mainly done as an exercise to get more familiar with Rust and parts of Aiken.)_
2022-12-03 10:16:16 -05:00
Kasey White ffa78e4c30 work out some initial direction for code gen 2022-11-08 22:21:07 -05:00
alessandrokonrad a83c731eb1 fixed err description 2022-10-17 08:35:45 -04:00
alessandrokonrad 28b9fed8e5 added i128 integer support 2022-10-17 08:35:45 -04:00
Lucas 6d6f671f4f
eval with inputs (#56) 2022-09-08 18:20:52 -04:00
Niels Mündler 739f38beac
UPLC data parsing support by CBOR notation (#37)
* Implement constant data parsing support

New notation: (con data #0000)
Where #0000 is the CBOR hex representation of a PlutusDatum

* Add pretty printing support for data

* Format
2022-09-08 16:10:12 -04:00
Kasey White 2bb482d9ec Using rc we now get code that runs much faster and
can run jpg contract with no inputs
2022-08-17 22:40:32 -04:00
rvcas f332dfeb38 feat: 3 new error cases and more generic pretty printing 2022-07-24 19:51:57 -04:00
rvcas dc4246244d
chore: document somethings 2022-06-14 17:27:27 -04:00
rvcas 984c253f31
feat: rename to aiken and add e2e tests for uplc 2022-06-11 23:22:24 -04:00
Kasey White 1ef116fcda fix: parse negative numbers and empty bytestrings 2022-06-10 17:23:36 -04:00
rvcas 2afded2d27
fix: builtin parsing 2022-06-10 11:48:46 -04:00
rvcas b05f0846a8
fix: moving to a parser that can handle left recursion 2022-06-10 01:55:28 -04:00
rvcas 86089b4bee
fix: different attempt 2022-06-09 00:44:52 -04:00
rvcas 474df4a3ae
fix: different attempt 2022-06-08 23:22:34 -04:00
rvcas 74df7f8a7c
fix: potential fix for left recursion 2022-06-08 22:21:22 -04:00
rvcas 1c8f3a736b
feat: new uplc parser 2022-06-08 21:51:04 -04:00
rvcas 21d713ece3
feat: change term parsing order 2022-06-07 22:02:20 -04:00
Kasey White 895f279be0 fix: parser fixes for spacing 2022-06-06 23:28:36 -04:00
rvcas 60a920a0ac
fix: more subtle things 2022-06-06 22:51:09 -04:00
rvcas 4c45c95620
fix: var parsing 2022-06-06 22:40:15 -04:00
rvcas 1ecd47a361
feat: clean up errors 2022-06-04 14:01:45 -04:00