JanetDocsPlaygroundI'm feeling luckyGitHub sign in



    (compile ast &opt env source lints)

    Compiles an Abstract Syntax Tree (ast) into a function. Pair the 
    compile function with parsing functionality to implement eval. 
    Returns a new function and does not modify ast. Returns an error 
    struct with keys :line, :column, and :error if compilation fails. 
    If a `lints` array is given, linting messages will be appended to 
    the array. Each message will be a tuple of the form `(level line 
    col message)`.

2 examplesSign in to add an example
(def ast '(print novar))
(def es (compile ast))
# => @{:column 11 :line 12 :error "unknown symbol novar"} returns struct with error on invalid ast
(def cc (compile '(print "Janet"))) # => <function _thunk> on success returns function
(cc) # => prints Janet