Frequently asked Questions

This list contains questions from users and developers. The developer questions are not separated from the others. This is to make the project more transparent for new users.

Some user based suggestions have influenced the developers. The most important are listed behind the questions. To keep the development of V2M stringent, not all ideas can be respected soon. To inform those creative users, the part "Suggestions and Proposals" was made. Please keep on mailing good ideas.

First the Questions.

How_to_load_programs?

How to start the compiler?

How to store the compiled code?

What are primaries?

What are primitives?

What are secondaries?

What are immediate commands?

What are symbols?

How to make local commands?

Is the V2M a Forth in Java?

Where is the FP aspect in the source code?

Is there some XML support?

How to make arrays?

Can a single command be scratched from the vocabulary?

How to access any stack position?

Why there is no while loop?

Why there is no switch-case construct?

Why the engine uses no Java lists?

Why some instantiating needs build?

This questions are really asked frequently. Some users wrote us that this list should be replaced by interesting questions. If the listed FAQs are not interesting for this kind of "power users", make your own list. This list is made for starting users, for those who wants to work with a tested and therefore a stable system.

The code is open source. Make better, faster, smaller, ... interfaces to subengines. Make it open source and we are the last who don't accept code like that. Much better for this users is, to join the develop team and realize a better V2M, which is accepted by more user than one.


Where is the instruction set?

The instruction set (vocabulary) is displayed by using the command commands. To get a description of any command see the documentation "vocabulary".


How to load programs?

The command is load. This command is postfix and uses any textfile as an input. Like direct typing, commands can be interpreted or compiled. If an input file includes a load command, the specified file is done immediately and after the work is done, the work on the origin file continues. There is no limit of nesting files.


How to start the compiler?

Compiling is initiated by any creative command. The most used compiling command is ":" (colon). This initiates the compiler, takes the next following non spaced character sequence foe naming and compiles all following word until ";" (semicolon) is red. The semicolon itself is not compiled.

The other (kernel) defined commands are variable, field and method. A variable is used to hold any object. The purpose of the last commands is to make internals of Java instances (or classes) directly available for the V2M. For more description see kernel.pdf.


How to store the compiled code?

There is no possibility to store compiled code. First – this project is open source! That explies the use of predefined code. Naturally, the basic object classes must be exist in it's compiled form. But this should be seen as the "hardware” of the engine, so all internals are open source too (since Java 6).


What are primaries?

Primary commands are always defined on subengine level. This command are not (directly) build out of existing commands. This commands must be compiled separately. Also the integration into the dictionary (vocabulary) must be done on this level.

Caution: Any use of self created commands like this implies non compatibility.


What are primitives?

Primitive commands are always created without (directly or indirectly) using any existing command. This commands must be compiled separately. Integration into the dictionary (vocabulary) must be done on this level.

Caution: Any use of self created commands like this implies non compatibility.


What are secondaries?

This commands are always build by using existing commands. Any secondary is compatible to the existing vocabulary. If no user defined primaries or primitives are used, any secondary is compatible to any V2M.


What are immediate commands?

Immediate commands are executed while compilation. All creative commands and all commands for flow control are immediate.

Most are compiling primitives to manipulate the instruction pointer (IP). While compilation some properties of compiled primitives are changed to set the so far unknown destinations of jump instructions. Jump instructions are primitive commands also. The names are known only by some immediate commands. So it is guaranteed the no jump or goto command exists on the user level.

Caution: The use of flow-control-commands outside a creation is possible but senseless. In most cases the subsystem gives an exception and the expected stack order is changed.


What are symbols?

Symbols are something like compiled literals. A symbol is always an identity function for exactly one value. The value is pushed onto the stack if a symbol is executed.

If "123" appears in the source code, "[n_sym]" with the value 123 as a its content is compiled. The behavior of string, boolean, character symbols is the same.


How to make local commands?

"No way" may the wrong but realistic answer! Correct is "You shouldn't".

Only by creating some own stack handling and binding separate stacks for data and return handling to commands. Don't forget to transfer the content of the local data stack to the stack of the calling level.


Is the V2M a Forth in Java?

There are a lot of parallels to Forth. The first impression could be a Java-Forth. But V2M is completely different. Forth should be seen as the initial idea. Just like the Java virtual machine (JM) has a lot of Forth, Java it is no Forth dialect.

In V2M complete Objects are created. The memory structure of Forth is linear, V2M storage is organized as a unbalanced tree. Much more differences could be listed here, but the only important thing is the similarity of Forth and V2M source code. This is given by the ingenious concept of Forth. This results in the JVM and V2M. Both machines uses the Forth idea as the base for modern programming.

The Commands which are taken from the Forth vocabulary are used to show the roots of Java and V2M.


Where is the FP aspect in the source code?

Functional programming (FP) is often associated to parenthesizing any term. The polish mathematician Jan Lukasiewicz created 1920 the so called reversed polish notation (RPN). To call a method in Java the polish notation (prefix) is used. A addition in this form is something like add(4 5). In RPN 4 5 add is the same. If the number of arguments is known, every method (function) call can be formalized without brackets and reformed into prefix notation.

In V2M every operator is a function. Because there is no syntax or grammar, the name of the add function is "+". To make the FP paradigm complete, any value is given via an identity function.


Is there some XML support?

This is in the project queue. We hope to present the first XML based examples in the first half of 2007.


How to make arrays?

The best way is to use the list methods in Java. In V2M only a recursive access to single elements is possible (because FP). Every array is an object, variables can hold any object. So any variable can hold variables. This technique is very inefficient, so go down to the sub engine and use lists.


Can a single command be scratched from the vocabulary?

There is no predefined command to do this. If a single command is erased, all other commands using the erased are undefined.

Naturally the user can create a command to do this. But it must be guaranteed that the object has no binding to any other.


How to access any stack position?

There are only the predefined commands to manipulate the stack. Any problem should be solvable with these commands. If it is useful to make own commands for manipulating the stack order, simply use the DS (data stack) property in the engine class to create. Also the methods in the package lists could be helpful.


Why there is no while loop?

It can be created with the kernel defined commands. Placing the leave command before the code sequence creates a while loop. Placing the leave command behind, a do while loop (or, with some negation, a repeat until) is done. Like this also for(...) loops are created.

The loop [leave] endloop construntion is much more flexible than conventional loops. Loops like do, while repeat, for have the same principle. So different naming is not necessary.


Why there is no switch-case construct?

Because it is not functional.

To handle different cases in mathematics strictly functionally, the H-function (to handle 0 separately the H-Function with H(0)=0.5) is used. This can be seen as a if-else in calculations.

To use of something like the H-function, the argument must be numeric. Because boolean and much more other types are not a numeric type, the H-function can't be used.

The best way is to create case sensitive commands with a return after the matching sequence is done. This makes the defined command conform to the FP paradigm.


Why the engine uses no Java lists?

The excellent collection class in Java is too big and universal for the simple to do list handling in V2M. Moreover some problems with synchronization appears if expanding Java lists at both sides.

The very simple V2M list handling is extreme small and can easy be transferred into other languages like C/C++. This makes it possible to create V2M with other subengines than Java.


Why some instantiating needs build?

Only creators with arguments needs the build method. The basic idea is to separate the arguments from the creator(s). In previewing the coming packages for linear algebra and complex numbers, it is necessary to have creators of the same name for different types (for example: Point2D.Double, Point2D.Float).

The user is free to integrate the build method in instantiating methods of his own. The discussion of this problem is going on in the V2M develop team.

Suggestions and Proposals

The following ideas came up while the developing and where received from interested users. Not all mails with new ideas are listed, only those which are realizable by the developing team. Some received suggestions are very interesting (Make the V2M a LISP without brackets. Integrate local stacks for every command to have local variables and functions.). The realization of good ideas like that are too complicated in the actual growing process of V2M. After Java 6 (or one of the successor) is the new subengine and most of the following points are done, new items will be integrated to the list.

The list starts with the highest priority. Replaced commands must have a "time out" phase before scratching. Uniformed commands should be build out of (sub)commands, to have a possibility of rewriting own commands. The "time out" phase must be longer.



Making more (all) engine-methods to V2M commands.

Replacing "." with "print" or "out".

Replacing "load" with "read" or "input".

Uniformed commands for stack manipulation to allow access to all stack locations.

Uniformed "load" (or its successor) for strings, files, URLs.

Using in- and postfix in a XML based language for V2M.

Interfacing to MathML.

Expand mathematical operators to linear algebra.