JONESFORTH git repository

A few years ago I wrote a literate FORTH compiler and tutorial called JONESFORTH. It’s a good way, I think, to understand the power and limitations of FORTH, and a good way to learn a completely different and mind-blowing programming language.

If you’ve not heard of FORTH before, cogitate on this: It is possible to write a FORTH program in 2,000 lines. A program which will boot and provide an entire development environment (inc. editor, compiler etc) on bare hardware.

Anyhow, I just uploaded my semi-private CVS repository to git. You can find it here:

http://git.annexia.org/?p=jonesforth.git;a=summary

The original tutorial is in two parts:

About these ads

24 Comments

Filed under Uncategorized

24 Responses to JONESFORTH git repository

  1. Cheng-Chang Wu

    Hi,

    thanks for your fantastic work.

    I’m using it as a starting point in my next project. It will be used as a vm of a compiler.
    http://github.com/chengchangwu/sparkforth
    http://github.com/chengchangwu/gefc

    According to the work of Richard Russell on bb4wforth, version 47 of jonesforth has a bug in /MOD which is easy to fix. The fix proposed by Richard is

    defcode “/MOD”,4,,DIVMOD
    pop %ebx
    pop %eax
    cdq
    idivl %ebx
    push %edx // push remainder
    push %eax // push quotient
    NEXT

    Another fix is the U. in file jonesforth.f which should uses U/MOD instead of /MOD. The proposed change of Richard is to add U/MOD to jonesforth.S and to modify the U. accordingly.

    defcode “U/MOD”,4,,UDIVMOD
    xor %edx, %edx
    pop %ebx
    pop %eax
    divl %ebx
    push %edx // push remainder
    push %eax // push quotient
    NEXT

    : U. ( u — )
    BASE @ U/MOD ( width rem quot )
    ?DUP IF ( if quotient 0 then )
    RECURSE ( print the quotient )
    THEN

    ( print the remainder )
    DUP 10 < IF
    '0' ( decimal digits 0..9 )
    ELSE
    10 – ( hex and beyond digits A..Z )
    'A'
    THEN
    +
    EMIT
    ;

    Will you fix this bugs in the git respository?
    Do you accept any patch?

    Cheng-Chang Wu

  2. Cheng-Chang Wu

    Execute me, the length of U/MOD is 5, not 4.

    According to Richard’s work, jonesforth’s implementations of /MOD and U. have bugs, implementations of DEPTH, .S, HERE, ALLOT, CREATE, VARIABLE, TRUE, FIND, WHILE, REPEAT, WORD, KEY and ‘ are not compliance with ANS Forth. I’m planning to change these and only these, to keep jonesforth’s minimalism and to pave the way for ANS Forth compliance.

    In other words, to make ANS Forth a natural extension of jonesforth.

    If you agree, I can send you my patch after I have finished it.

    • rich

      What I suggest you (and anyone else) do is to set up a git repo and/or website with whatever changes you want to make. Let me know about the new site and I’ll add a link to it on the main website.

  3. Alex Farlie

    Interesting to see your attempts Cheng-Chang Wu,
    do you have a contact e-mail?

  4. Pingback: Daniel’s Stuff » The Funky Clock

  5. Hi Rich. The annexia links are broken.

  6. git://git.annexia.org/git/jonesforth.git <– I can't clone from this URL :(

  7. Clyde W. Phillips Jr.

    Hi guys, just checking in. Glad to see fresh FORTH faces. 40+ years a FORTH-er here. Anyone into colorFORTH and the new greenarrays chip? Hairy stuff! Cheers, Clyde

  8. I’ve been porting JonesForth.S and JonesForth.f to Windows.
    Are you interested in reviewing my work before I publish it?

  9. I suppose I should have been more specific about what I thought Rich might want to review. Specifically, his tutorial prose has been significantly edited and so I wanted Rich to have an opportunity to see those changes before publication. I am still in the process of making the system more ANS compliant, so I’m not yet ready to publish. However, if anyone would like an advance copy, please drop me a note: mailto:jlarson43@juno.com

    • rich

      I’d say just go ahead and publish. It’s public domain after all — designed to be distributed with the least friction possible.

  10. Ok, Forth Fans:
    http://www.dst-corp.com/james/JonesForthInC-V148.html
    This isn’t the finished version, but something I hope will generate some buzz.

  11. Luke

    Excellent tutorial!
    I had some trouble running this, but once I followed the comment by Arto Bendiken posted at http://subvert-the-dominant-paradigm.net/blog/?p=54, “make test” works fine.
    “Note that if you attempt to run this on recent versions of Linux and the program simply aborts and prints out “Killed”, you will need to recompile without the “-Wl,-Ttext,0″ option to GCC.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s