2023-05-05 07:01:04 +02:00
|
|
|
# browser-js
|
|
|
|
|
|
|
|
### Description
|
2023-05-05 07:05:54 +02:00
|
|
|
javascript interpreter in javascript - poc
|
|
|
|
I saw that [JS-Interpreter](https://github.com/NeilFraser/JS-Interpreter) is single file so grabbed example fibonacci
|
2023-05-05 23:45:00 +02:00
|
|
|
and wrote [acorn](https://github.com/acornjs/acorn) parser from scratch.
|
2023-05-05 07:01:04 +02:00
|
|
|
|
2023-05-05 23:34:38 +02:00
|
|
|
### Run in browser
|
|
|
|
visit page [https://vane.github.io/browser-js/](https://vane.github.io/browser-js/)
|
|
|
|
|
2023-05-05 22:57:15 +02:00
|
|
|
### Basic tests
|
2023-05-05 07:01:04 +02:00
|
|
|
```bash
|
|
|
|
npm run test
|
|
|
|
|
2023-05-05 21:12:27 +02:00
|
|
|
> @szczepano/browser-js@0.0.1 test
|
2023-05-05 07:01:04 +02:00
|
|
|
> jest
|
|
|
|
|
|
|
|
PASS src/js.interpreter.test.ts
|
2023-05-05 23:24:55 +02:00
|
|
|
PASS src/visitors/array.test.ts
|
|
|
|
PASS src/decorators/loop.test.ts
|
|
|
|
PASS src/functions.test.ts
|
2023-05-05 22:57:15 +02:00
|
|
|
PASS src/decorators/condition.test.ts
|
2023-05-05 07:01:04 +02:00
|
|
|
|
2023-05-05 23:24:55 +02:00
|
|
|
Test Suites: 5 passed, 5 total
|
|
|
|
Tests: 17 passed, 17 total
|
2023-05-05 07:01:04 +02:00
|
|
|
Snapshots: 0 total
|
2023-05-05 23:24:55 +02:00
|
|
|
Time: 1.336 s, estimated 2 s
|
2023-05-05 22:57:15 +02:00
|
|
|
Ran all test suites.
|
2023-05-05 07:01:04 +02:00
|
|
|
```
|
|
|
|
|
2023-05-05 23:34:38 +02:00
|
|
|
### Build docs
|
2023-05-05 07:01:04 +02:00
|
|
|
```bash
|
|
|
|
npm run build:html
|
2023-05-05 23:34:38 +02:00
|
|
|
```
|
2023-05-05 07:05:54 +02:00
|
|
|
|
2023-05-05 23:34:38 +02:00
|
|
|
### Enable debug log
|
2023-05-05 07:05:54 +02:00
|
|
|
```bash
|
|
|
|
Constraints.IS_DEBUG = true
|
|
|
|
```
|