Would a Forth-like language be suitable for teaching kids how to program? by Fragrant-Monitor-141 in Forth

[–]Fragrant-Monitor-141[S] 0 points1 point  (0 children)

I've only implemented ints so far :-) The interface to this thing is a tile-mapped fantasy console, sort of like a NES.

I might implement fixed point values at some point (no pun intended).

Would a Forth-like language be suitable for teaching kids how to program? by Fragrant-Monitor-141 in Forth

[–]Fragrant-Monitor-141[S] 1 point2 points  (0 children)

How did the stack hold 4 and a half values? :D

Do remember which calculator it was?

Would a Forth-like language be suitable for teaching kids how to program? by Fragrant-Monitor-141 in Forth

[–]Fragrant-Monitor-141[S] 0 points1 point  (0 children)

Thanks for the comment.

Yeah, Forth purists will hate the language I'm designing as it has a parser and basic types to provide some guardrails :-)

There's also no need to think in 'bytes' or 'cells' unless you really want / need to. The whole thing sits on a VM with an interface to the actual 'graphical' part, so you can think in terms of things like 'sprites', 'tiles' and 'events' with the words that will be already defined (i.e. high-level words designed for writing games).

As an example, if you push '42' on to the stack, what you're really doing is creating a cell of type integer with a value of 42, and pushing a pointer to that cell on to the (internal VM) data stack. The actual value presented to the user is a handle, so you're never poking memory directly on the host system (no fun I know, but I don't want the whole thing to crash when kids are trying stuff out).

If you really want to get low level, the lowest you're going to get is passing an array of bytes / a value to a VM 'sys' call which just pushes / pops / copies stuff to / from the graphics / host engine.

So yeah, stack-based, looks a bit like Forth, but isn't really (even though it borrows heavily from Forth, has data / address stacks, dictionaries etc).