RetroChallenge – Forth-2012

Why Forth-2012?

A: Because all the cool kids do it.

Forth-2012 is the current standard for Forth? It defines the minimal wordset that most modern Forth implementations adhere to. By definition:

A system that complies with all the system requirements given in sections 3 Usage requirements and 4.1 System documentation and their sub-sections is a Standard System. An otherwise Standard System that provides only a portion of the Core words is a Standard System Subset. An otherwise Standard System (Subset) that fails to comply with one or more of the minimum values or ranges specified in 3 Usage requirements and its sub-sections has environmental restrictions.

So, why am I considering Forth-2012 for a “retro” challenge? And why not a “period correct” implementation and standard?

Well, CamelForth was already Forth-83, with some ’94, compliant. where’s the fun in that? So… By definition, CamelForth is already “Standard System Subset” compliant? Yay, me! Challenge complete…!

Not so fast. How compliant is it, you — or more correctly, I — ask?

So, I ask again, why Forth-2012?

Well:

  • my joy of “retrocomputing” is doing modern things with old (read: Z80) stuff.
  • there isn’t a Forth-2014 standard for the RC2014.
  • why not?

So, what words are needed to implement

Wordsets

Forth-2012 define the following wordsets:

  • core word set
    • basically, what makes Forth, umm…. forth….
  • block wordset
    • basic forth disk system
  • double-number wordset
    • for RC2014, that means 32bit numbers.
  • exception wordset
    • throwing and catching exceptions and errors
  • facility wordset
    • everything, but the kitchen sink?
  • file-access wordset
    • reading and writing files.
  • floating point wordset
    • mmmmm…. pi….
  • locals wordset
    • umm…
  • memory-allocation wordset
    • do we have enough memory for this?
  • programming tools wordset
    • yay, programming tools
  • search-order wordset
    • vocabularies, wordlists.
  • string wordset
    • I hope we don’t need to do regex
  • extended-character wordset
    • Isn’t 8-bit ASCII enough for everyone?

Well, really, apart from Core, the rest is all listed as optional.

What is the current state of compliance?

Luckily, there is a test suite: Gerry Jackson’s forth2012-test-suite: https://github.com/gerryjackson/forth2012-test-suite

Ah…. all the tests are in files.

I think that I’m going to need to implement file support, first…


Posted

in

,

by

Tags: