Commit Graph

35 Commits

Author SHA1 Message Date
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
rvcas 946937f945
feat: more debruijn stuff 2022-06-03 22:00:16 -04:00
rvcas f8edb5d519
feat: start debruijn conversion
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2022-06-03 00:36:39 -04:00
rvcas 83d6b5243e
feat: get program ready for debruijn 2022-06-02 21:39:09 -04:00
rvcas c7037ff8d9
feat: get string interning working
Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2022-06-01 01:11:30 -04:00
Kasey White 581b8fc85d feat: flat tweaks and string interning
Co-authored-by: rvcas <x@rvcas.dev>
2022-05-31 22:57:55 -04:00
Kasey White c01469ea51 feat: spec complaint program encoding
Co-authored-by: rvcas <x@rvcas.dev>
2022-05-27 22:37:08 -04:00
rvcas 33fee5b3e0
chore: switch to a mono repo 2022-05-22 12:40:52 -04:00