javascript run in javascript using acorn
Go to file
2023-05-05 22:39:53 +02:00
src feat: while loop 2023-05-05 22:39:53 +02:00
test fix: test layout 2023-05-05 10:02:55 +02:00
.eslintignore initial commit 2023-05-05 07:01:04 +02:00
.eslintrc initial commit 2023-05-05 07:01:04 +02:00
.gitignore initial commit 2023-05-05 07:01:04 +02:00
.parcelrc initial commit 2023-05-05 07:01:04 +02:00
.prettierrc.json initial commit 2023-05-05 07:01:04 +02:00
jest.config.js initial commit 2023-05-05 07:01:04 +02:00
LICENSE initial commit 2023-05-05 07:01:04 +02:00
package-lock.json initial commit 2023-05-05 07:01:04 +02:00
package.json initial commit 2023-05-05 07:01:04 +02:00
README.md feat: add condition test 2023-05-05 21:12:27 +02:00
tsconfig.json initial commit 2023-05-05 07:01:04 +02:00

browser-js

Description

javascript interpreter in javascript - poc
I saw that JS-Interpreter is single file so grabbed example fibonacci and wrote arcon parser from scratch.

Basic test to count fibonacci numbers

npm run test

> @szczepano/browser-js@0.0.1 test
> jest

 PASS  src/js.interpreter.test.ts
  js.interpreter.test
    ✓ calculate fibonacci (5 ms)
    ✓ array->set-index (1 ms)
    ✓ array->assign a[0] += 1
    ✓ array->assign  a[0] -= 1 (1 ms)
    ✓ array->assign - a[0] = a[0] - 1
    ✓ array->assign - a[0] = 1 - a[0] (1 ms)
    ✓ array->assign - a[0] = a[0] + a[0]
    ✓ array->assign - a[0] += a[0]

Test Suites: 1 passed, 1 total
Tests:       8 passed, 8 total
Snapshots:   0 total
Time:        0.789 s, estimated 1 s

Example that runs in browser with custom global function

npm run build:html

code is generated in dist/html

cd dist/html
python3 -m http.server 

open http://localhost:8000

to enable debug log - change

Constraints.IS_DEBUG = true