Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[flagged] A JavaScript Runtime in ~100 lines of code (github.com/jlcarveth)
9 points by JLCarveth on Aug 2, 2022 | hide | past | favorite | 11 comments


If 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...


Kind 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.


You 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.


> 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.


hey guys just made a python runtime in exactly 1 lines of code in bash:

    function piython { python "$@" }


If 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.


It is just a wrapper..


100 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..


Well 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.


No, 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

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

This is what I call "writing your own runtime"


Saved you a click.

Here you go:

    #!/bin/sh
    deno $@




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: