This commit is contained in:
Michal Szczepanski 2023-05-05 23:34:38 +02:00
parent 9fc711d0ae
commit 13764a1d35
2 changed files with 7 additions and 10 deletions

View File

@ -5,6 +5,9 @@ javascript interpreter in javascript - poc
I saw that [JS-Interpreter](https://github.com/NeilFraser/JS-Interpreter) is single file so grabbed example fibonacci
and wrote [arcon](https://github.com/acornjs/acorn) parser from scratch.
### Run in browser
visit page [https://vane.github.io/browser-js/](https://vane.github.io/browser-js/)
### Basic tests
```bash
npm run test
@ -25,18 +28,12 @@ Time: 1.336 s, estimated 2 s
Ran all test suites.
```
### Example that runs in browser with custom global function
### Build docs
```bash
npm run build:html
```
code is generated in dist/html
```bash
cd dist/html
python3 -m http.server
```
open [http://localhost:8000](http://localhost:8000)
```
### to enable debug log - change
### Enable debug log
```bash
Constraints.IS_DEBUG = true
```

View File

@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Test</title><style>.margin-10{margin-top:10px}</style></head><body> <div class="margin-10" style="width:50%;flex-direction:column;display:flex"> <h1>Sample Code</h1> <div style="flex-direction:column;display:flex"> <textarea cols="50" rows="10" id="code">var x = 2, y = 2;
var c = x + y;
console.log(c);
</textarea> <div class="margin-10"> <button id="run-btn" style="width:200px;font-size:2em">Run</button> </div> </div> </div> <div class="margin-10" style="width:50%"> <div id="log" style="min-height:50px;border:1px dashed #000"></div> </div> <script type="module" src="/index.35238944.js"></script> </body></html>
</textarea> <div class="margin-10"> <button id="run-btn" style="width:200px;font-size:2em">Run</button> </div> </div> </div> <div class="margin-10" style="width:50%"> <div id="log" style="min-height:50px;border:1px dashed #000"></div> </div> <script type="module" src="/browser-js/index.35238944.js"></script> </body></html>