0

I am interested in how a higher-level (Java-like) language could be build from a stack-based (Forth-like) language. Can anyone recommend some literature, preferably a book?

In case it helps: The application is construction of a higher-level language from Bitcoin's Script.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JohnF
  • 17
  • 1
  • To answer the question, a little background in computerhistory is necessary. Ada Lovelace has published in her diary a algorithm called "Note G" which uses the Analytical Engine as a stackmachine to write a highlevel program. Under the precondition that the Analytical Engine was real, it is possible to use polish notation for construct computerprograms. [Game-like Visualisation of the Analytical Engine](https://rclab.de/rclab/_media/analyticalengine/ae-game-v1.1.pdf) – Manuel Rodriguez Oct 11 '16 at 22:59
  • Here is a Lisp written in Forth: http://forums.parallax.com/discussion/160027/lisp-technically-scheme-written-in-forth – AshleyF Oct 12 '16 at 00:53
  • Java and .NET languages compile to a stack machine (JVM, CLR, ...) – AshleyF Oct 12 '16 at 00:54
  • Thank you for your responses. This is very helpful :) – JohnF Oct 14 '16 at 08:12
  • Marcel Hendrix ported Jack Crenshaw's classic "Let's build a compiler!" (https://compilers.iecc.com/crenshaw) to a dialect of FORT, look at http://home.iae.nl/users/mhx/crenshaw/tiny.html – vonbrand Apr 24 '18 at 16:50

1 Answers1

1

The script language used by Bitcoin has no loops and is not Turing-complete. See https://en.bitcoin.it/wiki/Script

It's not possible to write an interpreter or compiler for a Turing-complete language in this language.