The Top Loop

When storm is launched without any parameters, it launches the top loop. In this mode, the system provides an interactive prompt, similar to a shell. This prompt allows evaluating expressions in Basic Storm, both to test the language, and to interact with the system as a whole.

Note that the command storm might need to be modified on your system. See this page for more details.

When you launch Storm interactively in this manner, the system prints a greeting message similar to the one below:

Welcome to the Storm compiler!
Root directory: /home/user/storm/root
Compiler boot in 64.58 ms
Type 'licenses' to show licenses for all currently used modules.
bs>

The last line (bs>) is the prompt. The characters before the angle bracket (>) specifies the language that is currently used in the top loop. The letters bs corresponds to the file extension used by Basic Storm. This is the default language since we did not specify anything else.

We can now type expressions in Basic Storm to evaluate them. For example, if we type the expression: "Hello" * 4, we will get the following output:

bs> "Hello" * 4
=> HelloHelloHelloHello

As we can see, Storm evaluated the expression and printed the result on the next line, after the arrow (=>). We can also see that the arrow is not a part of the result. Finally, Storm prints a new prompt to indicate that it is ready for the next command. If we type print("Hello") we get the following output:

bs> print("Hello")
Hello
=> <void>

The first line (Hello) is the output from the print statement. The next line starts with an arrow (=>). Similarly to the previous example, this indicates the result of the expression we entered. Since the print does not return anything, the system prints <void> to inform us of this fact.

The prompt in the top loop supports all expressions that may appear inside a function in Basic Storm. For example, it is possible to call arbitrary functions in Storm, load extensions to Basic Storm, and otherwise interact with the system. For example, Progvis can be launched by typing: progvis:main().

One limitation is that it is currently not possible to define functions and types in the top loop. It does, however, provide some additional functionality as follows:

As a sidenote, the commands exit, variables, and licenses are implemented as regular functions that are visible in the top loop. That is why => <void> is printed after them.