News for hackers. Stuff that matters.
Re:Running Forth Unikernels by mruts on Monday April 01, 2019 @03:18PM (#19547065)
People talk about forth having no syntax the same way people talk about lisp having no syntax: not entirely correctly. Of course, every textual representation of anything has a syntax, but when people talk about something not having a syntax what they really mean is that the syntax is uniform: there is only one global (uniform) syntax.
Re:Running Forth Unikernels by madhadron on Tuesday April 02, 2019 @01:00AM (#19551222)
> there is only one global (uniform) syntax.

Not quite. You have access to the reader in Forth, and it's quite typical to write a word that takes over for the reader for some time and then hands back to the usual reader. Julian Noble used this to implement a subset of FORTRAN for computational physics (more convenient than postfix for doing that) and to make state machine transition tables into code. Sadly, he is no longer with us.

Common Lisp also provides access to the reader, so you can do the same trick, but it's not a ubiquitous thing to do the way it is in Forth.

Re:Running Forth Unikernels by boomlinde on Monday April 01, 2019 @08:08PM (#19549699)
> there is only one global (uniform) syntax.

While I agree with the general sentiment that Forth does have a syntax, this statement is not true in Forth. Instead, syntax is extremely local, because words may take over the parser and compiler to implement their own syntax.

For example, "(" (which is used for comments) is typically implemented as a word that immediately executes during the compilation phase, takes over the input loop and just reads and discards characters until it has discarded the matching ")" character before returning control to the regular compiler. It has its own little parsing loop going on with its own syntax, totally overriding any global syntax for as long as it feels like.

Re:Running Forth Unikernels by bunderbunder on Monday April 01, 2019 @05:32PM (#19548508)
I'd argue that Lisp has a syntax in that you do need at least a context-free grammar to describe valid Lisp programs.

With Forth, on the other hand, while there is a rule for deciding when one word ends and another ends, and how to interpret literals, I think that, for all practical purposes, there aren't actually any strings that are syntactically invalid.

As the ANSI Forth standard puts it:

> This Standard does not require a syntax or program-construct checker.

(page 33)

Re:Running Forth Unikernels by benj111 on Monday April 01, 2019 @03:35PM (#19547256)
I've always interpreted it as a lack of keywords etc.

Both lisp and forth can be built up from a small number of primitives. Everything you use day to day is basically optional.

Re:Running Forth Unikernels by MrEldritch on Monday April 01, 2019 @04:27PM (#19547859)
Yeah, there's "no syntax" in the sense that you could adequately describe the syntax rules on a Post-it.