Skip to content

REPL for LIGO

E. Rivas requested to merge er433/bin/repl into dev

This should implement a REPL for LIGO using linenoise. So far, it looks like this, but this is very much subject to change:

$ ligo repl cameligo
Welcome to LIGO's interpreter!
Included directives:
  #use "file_path";;
  #import "file_path" "module_name";;
In  [1]: #use "src/test/contracts/build/A.mligo";;
Out [1]: toto
In  [2]: toto;;
Out [2]: 1
In  [3]: #import "src/test/contracts/build/B.mligo" "MYMOD";;
Out [3]: Done.
In  [4]: MYMOD.toto;;
Out [4]: 32
In  [5]: MYMOD.A.toto;;
Out [5]: 1
In  [6]: let f (x : int) = MYMOD.f (unit, x);;
Out [6]: f
In  [7]: f 4;;
Out [7]: ( LIST_EMPTY() , 48 )
In  [8]: module EURO = struct
    type t = nat
    let add (a, b : t * t) : t = a + b
    module CONST = struct
        let zero : t = 0n
        let one : t = 1n
    end
end;;
Out [8]: EURO
In  [9]: module US_DOLLAR = EURO;;
Out [9]: US_DOLLAR
In  [10]: US_DOLLAR.CONST.zero + 32n;;
Out [10]: +32
Edited by E. Rivas

Merge request reports