Table des matières

Installation

Under Construction

Download

Downloads

Environment Variables

Running W requires two mandatory and one optional environment variable :

Usage

To run a W program, both the main program and the library, three commands must be executed:

  1. Compilation: The W source code is compiled into W assembler, in text format.
  2. Assembly: The W assembler in text format is compiled into binary: this is the format recognized by the W runtime.
  3. Execution: The W binary is interpreted by the W runtime. A library can only be called with the W binary version of the library being called.

Note: Modules called by invoke are shared libraries at the OS level (DLLs on Windows, so on Unix).

Additional executables:

Compilation

>
> Usage: lwc [-WSRC:<path>] [-WLIB:<path>] <file>.w
>

The lwc compiler needs to know:

The compiler stops at the first error encountered, displaying the error label, the line of source code concerned, and the error location.
Once the W program is compiled without errors, a file named <file>.wa will be created in the WLIB directory.

Assembly

>
> Usage: lwa [-c|u] [-WLIB:<path>] <file.wa|file.wp>
>

The assembler “lwa” needs to know the directory where to read the source assembler file and where to write the generated w binary : the contents of the WLIB environment variable, or failing that, the value of the -WLIB command-line parameter. The assembler converts a *.wa file to a *.wp file.
The -c option in the assembly allows you to compress the generated wp binary. Compressed binaries are automatically handled by the disassembler (option -u) and by the w runtime (program lw below).\
The assembler also allows disassembling a W binary by producing the assembler source code in text format : add the option -u to the command. The disassembler converts a *.wp file to *.wa. The rule regarding the WLIB directory applies to both disassembly and assembly.

Execution

>
> Usage: lw [-d] [-t] [-WBIN:<path>] [-WLIB:<path>] [-WSRC:<path>] <prog> [parms...]
>

The W runtime is launched with the executable lw. The W runtime needs to know :

The W runtime is located in a directory present in the OS's PATH, and should therefore be found automatically by the shell.

The directory containing the base path to the sources (WSRC) is optional. It is useful if the debugger needs to be used. The -d option starts the runtime in debug mode on the program. The -t option displays the assembler instructions executed by the runtime for the requested program in the console. The runtime executes the binary program W <prog> (the .wp extension is not required).
The following are potential parameters that will be used by the W program (not by the runtime).

Formatting

>
> Usage: lwf <file.w>
>

The formatter reads the input file, <file.w>, reformats it, and then overwrites the original file with the formatted version. The formatted version is also sent to standard output.
Formatting is done according to the W standard :

Lex Compilation

Under Construction