Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #58549 > unrolled thread

Forth in Javascript?

Started byBrad Eckert <hwfwguy@gmail.com>
First post2017-05-02 20:54 -0700
Last post2017-05-03 10:29 -0700
Articles 9 — 6 participants

Back to article view | Back to comp.lang.forth


Contents

  Forth in Javascript? Brad Eckert <hwfwguy@gmail.com> - 2017-05-02 20:54 -0700
    Re: Forth in Javascript? Ron Aaron <rambamist@gmail.com> - 2017-05-03 07:05 +0300
    Re: Forth in Javascript? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-03 06:54 +0200
    Re: Forth in Javascript? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2017-05-03 03:53 -0400
      Re: Forth in Javascript? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-03 10:20 +0200
        Re: Forth in Javascript? Brad Eckert <hwfwguy@gmail.com> - 2017-05-03 09:55 -0700
          Re: Forth in Javascript? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-03 19:36 +0200
    Re: Forth in Javascript? JUERGEN <epldfpga@aol.com> - 2017-05-03 03:05 -0700
    Re: Forth in Javascript? crc <charles.childers@gmail.com> - 2017-05-03 10:29 -0700

#58549 — Forth in Javascript?

FromBrad Eckert <hwfwguy@gmail.com>
Date2017-05-02 20:54 -0700
SubjectForth in Javascript?
Message-ID<29323fdc-9fb6-49c6-afd9-47b1865d1d63@googlegroups.com>
Just something I'm mulling over.

I know, it sounds very slow, an interpreter running on an interpreter. However, some major web browsers can run extensions written in Javascript. The browser window can then be your console. It looks like the browser can access files and serial ports, so a Forth development environment (for embedded systems) could run in a browser. Slowness isn't necessarily a problem then.

The browser is basically a really fancy terminal with all of the HTML5 toys. One could implement a colorForth as a browser extension.

I've heard of Forths in Java, but Javascript is a completely different animal.

[toc] | [next] | [standalone]


#58550

FromRon Aaron <rambamist@gmail.com>
Date2017-05-03 07:05 +0300
Message-ID<oebknq$4hf$1@dont-email.me>
In reply to#58549

On 03/05/2017 6:54, Brad Eckert wrote:
> Just something I'm mulling over.
> 
> I know, it sounds very slow, an interpreter running on an interpreter. However, some major web browsers can run extensions written in Javascript. The browser window can then be your console. It looks like the browser can access files and serial ports, so a Forth development environment (for embedded systems) could run in a browser. Slowness isn't necessarily a problem then.
> 
> The browser is basically a really fancy terminal with all of the HTML5 toys. One could implement a colorForth as a browser extension.
> 
> I've heard of Forths in Java, but Javascript is a completely different animal.
> 

https://www.npmjs.com/package/js-forth

[toc] | [prev] | [next] | [standalone]


#58551

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2017-05-03 06:54 +0200
Message-ID<86shkmh759.fsf@molnjunk.nocrew.org>
In reply to#58549
Someone else ported my Forth to asm.js, which is a subset of JavaScript.

It's running here:
http://larsbrinkhoff.github.io/lbForth/forth.html

[toc] | [prev] | [next] | [standalone]


#58556

FromRod Pemberton <NeedNotReplyHere@xrsevnneqk.cem>
Date2017-05-03 03:53 -0400
Message-ID<20170503035336.0ddeb1c8@_>
In reply to#58549
On Tue, 2 May 2017 20:54:52 -0700 (PDT)
Brad Eckert <hwfwguy@gmail.com> wrote:

> I've heard of Forths in Java, but Javascript is a completely
> different animal.

I posted these to c.l.f. a while back:
https://skilldrick.github.io/easyforth/
https://brendanator.github.io/jsForth/

So, now you've got 3 or 4 to compare.


Rod Pemberton
-- 
"Well, many people are really f---ing stupid too.  Should we just adopt
all their standards?" - George Carlin

[toc] | [prev] | [next] | [standalone]


#58557

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2017-05-03 10:20 +0200
Message-ID<86lgqegxlt.fsf@molnjunk.nocrew.org>
In reply to#58556
Rod Pemberton wrote:
> I posted these to c.l.f. a while back:
> https://skilldrick.github.io/easyforth/
> https://brendanator.github.io/jsForth/

For any implementation language, there is about a ton of Forths on
GitHub.  You'd probably just want the good ones, but it's anyone's guess
which they are:

https://github.com/drom/forth
https://github.com/eatonphil/jsforth
https://github.com/marianoguerra/ricardo-forth
https://github.com/paxl13/jsForth
https://github.com/nishio/FORTH-on-browser
https://github.com/ajlopez/SimpleForth
https://github.com/fatman2021/forthjs
https://github.com/cmwt/forth-js
https://github.com/mark-hahn/fjs
https://github.com/yapcheahshen/jeforth
https://github.com/connorberry/forth4js
https://github.com/RauliL/hjsorth
https://github.com/rjose/jsforth
https://github.com/graham/fifth
https://github.com/tptb/sforth
https://github.com/ramunas/jorth
https://github.com/12pt/fifth.js
https://github.com/Bushmills/jsforth

... and more ...

[toc] | [prev] | [next] | [standalone]


#58596

FromBrad Eckert <hwfwguy@gmail.com>
Date2017-05-03 09:55 -0700
Message-ID<ca42659b-75a5-41f4-8fbb-e885eb363f1d@googlegroups.com>
In reply to#58557
On Wednesday, May 3, 2017 at 1:20:48 AM UTC-7, Lars Brinkhoff wrote:
> Rod Pemberton wrote:
> > I posted these to c.l.f. a while back:
> > https://skilldrick.github.io/easyforth/
> > https://brendanator.github.io/jsForth/
> 
> For any implementation language, there is about a ton of Forths on
> GitHub.  You'd probably just want the good ones, but it's anyone's guess
> which they are:
> 
> https://github.com/drom/forth
> https://github.com/eatonphil/jsforth
> ...

Thanks. From the repositories I looked at, they are all written in JavaScript. No surprise, but I'd rather see a JS kernel loading a bunch of Forth. There are plenty of user interface styles to look at, though.

I think a bytecode interpreter implemented as a giant switch statement would be pretty fast. A browser's JIT compiler should be smart enough to compile an N-way jump.

[toc] | [prev] | [next] | [standalone]


#58602

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2017-05-03 19:36 +0200
Message-ID<86a86thmgb.fsf@molnjunk.nocrew.org>
In reply to#58596
Brad Eckert <hwfwguy@gmail.com> writes:
> From the repositories I looked at, they are all written in
> JavaScript. No surprise, but I'd rather see a JS kernel loading a
> bunch of Forth.  I think a bytecode interpreter implemented as a giant
> switch statement would be pretty fast.

The asm.js target in my Forth is like that.  One part of the kernel is
written in Forth, and the other part consists of primitives written in
JavaScript.  The kernel loads the rest of the system from Forth source.

Every primitive has a unique ID, which is used by a switch statement in
the inner interpreter.

[toc] | [prev] | [next] | [standalone]


#58570

FromJUERGEN <epldfpga@aol.com>
Date2017-05-03 03:05 -0700
Message-ID<21ec07c6-a3a5-4625-bf67-32826fe8ccf3@googlegroups.com>
In reply to#58549
On Wednesday, May 3, 2017 at 4:54:54 AM UTC+1, Brad Eckert wrote:
> Just something I'm mulling over.
> 
> I know, it sounds very slow, an interpreter running on an interpreter. However, some major web browsers can run extensions written in Javascript. The browser window can then be your console. It looks like the browser can access files and serial ports, so a Forth development environment (for embedded systems) could run in a browser. Slowness isn't necessarily a problem then.
> 
> The browser is basically a really fancy terminal with all of the HTML5 toys. One could implement a colorForth as a browser extension.
> 
> I've heard of Forths in Java, but Javascript is a completely different animal.

I had been looking for a web based Forth starter solution and easyFORTH fitted the requirements: no installation, copy and paste into the window, and MPE VFX AIDE has a nice litte editor, see how SNAKE works, and as for beginners even the explanations of the basic words are there. It would be nice if some words could be added to use it from a mobile or tablet.

[toc] | [prev] | [next] | [standalone]


#58601

Fromcrc <charles.childers@gmail.com>
Date2017-05-03 10:29 -0700
Message-ID<c2928f53-c86b-4a36-b42d-c8237b9ce3f5@googlegroups.com>
In reply to#58549
On Tuesday, May 2, 2017 at 11:54:54 PM UTC-4, Brad Eckert wrote:
> Just something I'm mulling over.
> 
> I know, it sounds very slow, an interpreter running on an interpreter. However, some major web browsers can run extensions written in Javascript. The browser window can then be your console. It looks like the browser can access files and serial ports, so a Forth development environment (for embedded systems) could run in a browser. Slowness isn't necessarily a problem then.
> 
> The browser is basically a really fancy terminal with all of the HTML5 toys. One could implement a colorForth as a browser extension.
> 
> I've heard of Forths in Java, but Javascript is a completely different animal.

If you want something less conventional, I have a version of Retro running
in a browser based interface.

http://forthworks.com:8000/

This is running the standard image on a javascript implementation of my MISC VM.

(Apologies if this is a little slow to load; the server hosting the files is written in Retro and hasn't been optimized yet).

-- crc

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web