Sunday, November 1, 2015

An implementation of Forth in Java that runs on Android! – Unocero

leoforth00

Programming languages ​​come in many colors and flavors. Some are functional, imperative, special-purpose, general purpose, interpreted, compiled, and so on. One of the most interesting is Forth, which is-according to Wikipedia- imperative structured language, based on the use of the stack. This language works by creating “words” that are the sequence of instructions that are executed in the interpreter. Overall Forth interpreter comes by way because on the one hand, it is much easier to program as well. Moreover, it is in many ways more practical because it can be on different platforms. Simply write the interpreter and not think about writing a compiler for each existing platform.

In this case, we find an implementation of Forth written in the Java language . The author makes it clear that is not a Forth ANS, ie completely standard with the definition of it, but many of the words he uses language can easily be defined in this implementation.

Because LeoForth , the name of this implementation is written in Java, it can be easily ported for use on Android devices. In fact, it gets in the app store Google Play. Leonardo Cecchi is its author and so far has in store between 1000 and 5000 discharges. No wonder when you consider how popular Facebook apps, but these efforts to promote a simple and clear language in its execution, is slowly gaining some spaces

According to the author, this implementation has its peculiarities.:

  • It is compiled into a set of primitives that are stored in a “virtual memory Forth”
  • The stack consists of Java objects
  • Strings are represented as strings in Java, so two parameters are required for passing strings to stack (address and length)
  • it has an internal Help system
  • Can handle multiple vocabularies
  • You can create instances of Java objects
  • You can invoke methods on Java objects
  • You can access all classes and libraries Java
  • has a simple development environment, with a code editor and a shell of Forth
  • LeoForth can be used as a language of internal scripts, embedded in Android

Probably worth a try using Forth for more virtues. It is the universal language and may be useful or interesting for certain types of applications. However, his philosophy on handling the stack makes it considerably different to many languages ​​in which the programmer simply can not control the system stack. Take a eye. You see it is not difficult to program

References:.

LeoForth
LeoForth (source)
LeoForth (binary)
Google Play

LikeTweet

No comments:

Post a Comment