4 ms·
A JavaScript Runtime in ~100 lines of code
- mati365 4y agoIt is just a wrapper..
- deleted 4y ago[deleted]
- kaladin_1 4y agoWell done It appears Js runtime is the new Hello world!. Anyway, like the sibling comment mentioned. It is not really a full runtime. You're using deno. The title made it seem like you had a Js runtime independent of an existing.
- phpisatrash 4y agoYou cannot call it as a JavaScript runtime in 100 lines of code. You are basically using deno's runtime. So it's not totally yours. This is just a wrapper. I have to admit that before opening this link i thought that it could be a kind of wrapper or using the V8 engine or something else.
- orra 4y ago> This is just a wrapper. To be fair to the author, this project shows how to do IO with the wrapper. It binds filesystem and web request APIs, so they work. This doesn't just evaluate pure JavaScript functions using Deno. But yes, from the title, I was hoping for some insanely succinct lexer, parser, and eval loop.
- andrew_ 4y agoKind of like 3D printing a badge with your name on it, gluing it to your car, and telling folks you built a car in an hour.
- tiagod 4y agoIf this is a JS runtime in 100 lines of code, a file with 'node\n' would be a single line JS runtime, just start it with 'sh runtime.sh' and make sure you have the nodejs executable in your path...
- ekinertac 4y agohey guys just made a python runtime in exactly 1 lines of code in bash: function piython { python "$@" }
- eatonphil 4y agoIf you said "a JavaScript distribution" instead of runtime I think it would be clearer. Node is a distribution of v8. Deno is a distribution of v8. Bun is a distribution of JSC. And so on.
- rastapasta42 4y agoNo, this is not how you do a runtime. Here's my Lisp interpreter in a couple of lines of Rust: https://github.com/rpasta42/LambdaOxide https://github.com/rpasta42/LambdaOxide And here's the accompanying graphics environment for my Lisp dialect (with a couple of mini-games as an example): https://github.com/rpasta42/skomakare https://github.com/rpasta42/skomakare This is what I call "writing your own runtime"
- jesse__ 4y ago100 lines of code seems misleading. How many lines of dependency code? Deno relies on V8, which I'd wager is on the order of a million or more lines..
- valbaca 4y agoSaved you a click. Here you go: #!/bin/sh deno $@