runtimeverification / plutus-core-semantics

BSD 3-Clause "New" or "Revised" License
27 stars 5 forks source link

how to run plc code? #39

Closed clojurians-org closed 6 years ago

clojurians-org commented 6 years ago

when i run the following code, it report ocaml error, where i can find the log? what's the right way to run it?

./build kplc run execution test/case-simple.plc
make: Nothing to be done for 'execution'.
make: Nothing to be done for 'translation'.
make: Nothing to be done for 'translate-to-iele'.
krun --directory /home/larluo/work/git/plutus-core-semantics/.build/execution test/case-simple.plc
Fatal error: exception Prelude.Stuck(_)
[Error] Critical: Failed to execute program in ocaml. See output for error
information.
nishantjr commented 6 years ago

@clojurians-org we need to specify a main module, a main function to run and arguments to pass to it. We've just push up some changes that make this easier. You'll need to run:

./build exec test/arith-ops.pre.plc Foo add --args 5 6

where Foo is the module name, add is the function name, and 5 and 6 are (integer) arguments we are passing. To pass bytestring arguments use #1234 instead.

We've generally been using the unit test framework to pass arguments so had not bothered with a command line interface. We've just put one in now though.

clojurians-org commented 6 years ago

thanks. if i translate to iele code, then how can i run it ?

nishantjr commented 6 years ago

Ah, again you've caught us relying on the test framework. I'd say the easiest way would be to write a test in bin/test_plc.py. The iele implementation requires that you pass in a JSON file including the iele program, the arguments and the expected output.

clojurians-org commented 6 years ago

i can't understand the JSON file format, can you offer me a format specification document link for iele-json? thanks

nishantjr commented 6 years ago

https://github.com/runtimeverification/iele-semantics/blob/master/ethereum.md#running-tests

https://github.com/runtimeverification/iele-semantics/blob/master/ethereum.md#checking-state