From Newsgroup: comp.compilers
Roger L Costello schrieb am Dienstag, 15. November 2022 um 17:52:01 UTC+1:
minf...@arcor.de wrote:
use Forth as your toolbox to make your own DSL
and you can go _very_ far without diving into all
those dragon books and gigabyte compilers and
toolsets.
Fascinating!
What is it about the Forth programming language that makes it easy to
implement DSL's?
/Roger
[It has small efficient implementations, it generally lets you get close to the hardware,
and the RPN syntax lets you define new operators that work like the built-in ones. -John]
Forth comprises a _very_ simple interpreter and compiler. Both can be
modified and enhanced easily to the problem domain. IOW Forth is
extensible to the core of the language while still being small and
simple enough to fit into one single person's head.
Citing its inventor Chuck Moore:
"By permitting the program to dynamically modify its control language,
we mark a qualitative change in capability. In a sense, our program
has evolved into a meta-language which we apply to the application.rCY
Another citation (Bernd Paysan):
rCLIn this respect, Forth is quite similar to Lisp and its descendantsrCa
[but] Forth differs from Lisp in that it doesnrCOt use lists, neither
for calling, nor for storing multiple values. Forth uses a stack to
pass data between words, and it uses the raw memory (as seen by the
assembler programmer) for more permanent storage. ItrCOs much lower
leveled than Lisp, and thatrCOs one of the reason why it is fast.
ItrCOs not only fast, the simplicity makes it very small, too. Forth is
the ultimate language for building extensions. Programming in Forth is generating higher levels of abstractions, until you have a language
well fitted to solve your problem. The simplicity of the underlying
system allows it to rely on it, which is important when you search
bugs.
The usual approach for application programming is to keep each layer
simple, too. This is essential for rapid development of critical
applications."
--- Synchronet 3.21b-Linux NewsLink 1.2