jscl-project / jscl

A Lisp-to-JavaScript compiler bootstrapped from Common Lisp

Home Page:https://jscl-project.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use the jscl as a object in other cases besides the repl example?

noloop opened this issue · comments

I'm confuse how to use it. I need something like this:

const jscl = new jscl();
const result= jscl.eval_string_lisp("(+ 1 1)");
console.log(result); // => 2

But I don't understand how to obtain this or if it is possible.

I tried:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSCL</title>
    </head>
    <body>
        <script src="./JSCL_files/jscl.js" type="text/javascript"></script>
        <script>
             console.log(jscl.lisp_to_js("(+ 1 1)"));
        </script>
    </body>
</html>

And I get:

Uncaught TypeError: jscl.lisp_to_js is not a function
    at jscl-test.js:2

Please load the compiled JS files as in https://jscl-project.github.io and type as below:

> jscl.evaluateString('(+ 1 1)')
2

Thanks