marsc – compiler for programs written in the Mars language


marsc [-o output-file] [--backend=backend] [-m name] [-h | --help] [--version] [mars-source-file]


marsc is the compiler for the Mars programming language. This command takes a single Mars program, and compiles it with a particular backend.


This program isn’t particularly useful right now; all of the backends are used mainly for debugging.

Future versions of Mars may have useful backends (ie. compilation to native code or other executable file formats).


-o output-file

Compile to the given output filename. If unspecified, the output filename will be based on the input filename, but with a different extension (depending on the backend).


Use a specific backend. This determines what format the output file will be in.

The default backend is asm.

Backends available: pretty, asm.

-m name

Specify the name of the main function (program entrypoint). This names the function which will be executed upon program startup. It must have type () -> Int.

If unspecified, there will be no function called at startup, and the program will serve as a library only.

-h, --help

Display a short help page, then quit.


Display version and copyright information, then quit.

Exit status

marsc will exit with a status of 1 if any fatal errors occur, including compiler errors or illegal main functions.

Otherwise, marsc will set its exit status to 0.



Colon-separated list of paths to search for Mars source files. Searched when the import statement is used to import Mars modules.


A list of known bugs is available at Bugs should be reported using the link on that page.

Table Of Contents

Previous topic


Next topic

Mars Language Reference

This Page