Compiling stack languages

If you have any questions, remarks, ... if you need help... its here...

Compiling stack languages

Postby joekillian » 14 Apr 2018 20:07

Is there anything inherently simpler about compiling stack based languages to assembly than other languages like C++?

For example, if a "conventional" language was designed to allow easy byte code translation to a stack based intermediate language "then" to assembly would that allow easier compiler design?
Posts: 7
Joined: 17 Jul 2015 20:13

Re: Compiling stack languages

Postby Franck » 15 Apr 2018 12:04

It's not particulary stack based languages, but RPN notation that helps to simplify compilation.

With RPN, there is no instruction (separated with ; in C or C++) nor parenthesis : you just execute the words one after the other.
So the compilation is simplified.

In C or C++, you have to :
- identify the instructions (lexical).
- Create a tree that will allow to execute the instructions.
- Translate this into binary.

There is no such things in Oforth (or Forth).
Also, there is no separated compilation phase and, nevertheless, you can generate native code easily.

Posts: 171
Joined: 29 Oct 2014 19:01

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests