The following identifiers are reserved for use as keywords and may not be used otherwise: Limbo includes a small, yet complete, set of reserved words. The program name itself is passed as the first element in theįor a formal Limbo language definition, see For example:Īny command line arguments, in the above example Simply type the name of the executable file, excluding theĮxtension, at the Inferno shell prompt. Also, see the Inferno Reference Manual manual page entryįor more information about the compiler options. The compilerįor more details about Limbo file name conventions and compiling Limbo programs. If there are no errors, the Limbo compiler creates the executable file, called a Dis file. If there are no arguments, then we print theĪt the Inferno shell prompt, invoke the Limbo compiler (has some value) then we print the message and the head of the tail (the second element in the Which is a keyword that means it contains nothing. Since we are only interested in the remainder of the In Limbo are a group of sequential, ordered elements. Lines 16 to 19 print the message using the command line argument passed to Comments in Limbo start withĪnd extend to the end of the line. Library module and gives the program access to the functions and data implemented in the Lines 12 to 20 contain the definition of theįunction, or the statements that will be executed.Įarlier, in Line 4, we mentioned that the initial value of If the program does not expect any arguments passed from the command line, it can be named List of the arguments passed to this module via the command line. If that is the case, as with our example, the argument can be named This argument is required even if the program does not do any graphics. Hence the reason that file was included (Line 5). This function has two arguments, aĪnd the two arguments are required of all programs that are invoked by the Inferno shell command line.įunction in C-it specifies where execution starts in the module and captures the graphics context and command-line arguments, if any. Module that we stated was implemented in this file in Line 1. Is declared to be a handle to the functions and data of the Keyword is always enclosed in double quotes ( "mod.m"). It is analogous to C¿sĭirective, however. Is a keyword, not a preprocessor directive. Limbo does not have a preprocessor, as does C. Line 3 includes the interface to the System ModuleĪnd Line 5 includes the interface to the Draw Module Interface declarations of two modules that the module uses. Is a special interface for modules (programs) launched at the Inferno shell. The file name does not need to match the module name or the implementation name, although conventionally they do. In this simple example, as is common with simple Limbo programs, the interface and implementation are in the same source file. (The line numbers are for reference only.) It illustrates the key parts of a basic Limbo program.įollowing the line-by-line program description, use Inferno¿s Limbo compiler to compile the example and then run the program from an Inferno shell (command line).ĩ init: fn(nil: ref Draw->Context, argv: list of string) ġ2 init(nil: ref Draw->Context, argv: list of string)ġ7 sys->print("Hello, %s!\n", hd tl argv) This is a simple greeting program (a twist on the venerable ``Hello, World!''). To illustrate the Limbo language, here is a simpleĮxample of a Limbo program. It covers the primary aspects of the language and includes many Limbo program samples.įor a formal Limbo language definition, see Appendix A, Section which delves into the basics of the Limbo language itself. This section dissects a simple Limbo program that illustrates the basics of every Limbo program. This chapter introduces Inferno¿s programming language, Limbo, particularly for those new to Limbo.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |