6 ms·
Nice. I built something basically just like this for work for the same reason last year. It only look a few hours though, cause I just used Acorn [0] to parse m
by yokljo 11mo ago
Nice. I built something basically just like this for work for the same reason last year. It only look a few hours though, cause I just used Acorn [0] to parse my JS, then directly evaluated the AST. It also had an iteration limit and other configurable limits so I can eval stuff in the browser without crashing the tab. I did not use an LLM.
[0]: https://github.com/acornjs/acorn https://github.com/acornjs/acorn
- artpar 11mo agoThis is exactly what I wanted and couldn't find. Ended up creating along with an interpreter (so slightly easier then walk and execute)
- artpar 11mo agoI am actually going to use this instead of the one I created ( I could never get to correct ASI handling in that grammar)
- yokljo 10mo agoHaha nice! It's a good library, and it's flexible enough that you can extend the syntax of JS however you like (with some difficulty, as it's not exactly documented). I experimented with adding my own type system to JS by using Acorn. Can recommend.