Skip to main content

Crate hexicon_compiler

Crate hexicon_compiler 

Source
Expand description

The Hexicon compiler.

compile_program turns the source files of a program into a program image, and compile does the same for a program that is one file. The preprocessor (pp) can also be used on its own. read_project reads what to build from the command line of hexicon build and the manifests (hexicon.toml) it names.

The compiler has no access to files, to a clock, or to a console of its own; whoever uses it supplies the files through pp::SourceFiles and decides what to do with what comes out.

Modules§

builtin
The libraries built into the compiler: Hexicon’s system library (the program’s entry point, the classes every program is built on, and the headers that declare the virtual machine’s built-in functions and classes) and Hexad. Their files are in lib/system and lib/hexad, and are read from there when the compiler is built, with the built-in-libraries feature, which is on unless turned off. (The virtual machine, which compiles code while a program runs but builds no games, turns it off.)
dynamic
The dynamic compiler: code compiled while a program runs, as CompiledCode and the system library’s Compiler object ask, against the names of the program that is running.
english
Hexicon’s English: a game, or a part of one, written in sentences.
ifid
A game’s IFID: the identifier the Treaty of Babel gives every game, the same in all its versions. A new one is a random UUID; the build checks the one a game gives.
pp
The preprocessor: source files in, lines of preprocessed text out.

Structs§

CompileOptions
What to compile, and how.
Compiled
What came of compiling.
DirEntry
What is in a folder, as expand_resources is told it.
DocEnum
The values of an enumeration, as one enum declares them.
DocFile
A source file, and its text.
DocFunction
A function.
DocMacro
A macro: #define TWICE(x) ((x) * 2).
DocMember
A property or method of a class or object.
DocMessage
A message a game can give text of its own for: the id of a msgText() or a showMsg(), and its text.
DocObject
A class or a named object.
DocPlace
A place in a source file.
DocTemplate
A template, which says what values written without names stand for: Room template 'roomTitle' "desc"?;.
DocUse
A name used in code, in a source of the game’s own: a class’s, an object’s, a property’s, a function’s, or anything else that is not a local’s. Each place a name is written is one, its definition’s too.
DocVerb
A rule of the grammar for an action: verb Toll 'toll' singleDobj.
Documented
What document found.
Project
A program to build.
ProjectPaths
Where libraries are looked for, besides the folders --library-path names and the libraries built into the compiler.
Resource
A file bundled as a resource, and its name in the image.
ResourceSpec
A file or a folder to bundle as resources.
RuntimeSymbol
A global symbol, and its value in the image.
Shown
The problems of a build that are shown, as hexicon build and the language server show them, and those that are only counted.

Enums§

ProjectError
Why there is nothing to build.
RuntimeValue
What a global symbol means.
Tok
The kinds of token. They are in the order the reference compiler has them in, so that a kind’s number here is its number there, which is what lets the two tokenizers’ output be compared.

Constants§

MANIFEST
The name a manifest has.

Functions§

compile
Compile a program that is a single source file.
compile_and_document
Compile a program, as compile_program does, and say what its sources define, as crate::document does, from the same reading: the second reading of each source, which both need, is done once. If the compile stops before every source is read, what was found is said with the problems that stopped it (its diagnostics), as crate::document says what stopped it.
compile_program
Compile a program from its source files, which are put together in the order given.
document
Read a program’s sources, as a build would, and say what they define.
expand_resources
The files the resources name, each folder replaced by the files in it, in the order the system lists them, as the reference does. A file in a folder is named by the folder’s name, a /, and its own. list_dir gives what is in a folder, or nothing for a path that is not one.
read_project
Read what to build from the command line of hexicon build, and from the manifest it names.
shown
Which of a build’s problems are shown. In a Hexicon source, a message is shown once, and what follows a string with no end in the same file is only counted: it follows from that. Whether warnings are shown is the caller’s to decide.
with_preprocessor
Do something with a source’s preprocessor, set up as a build of the program sources sets it up: its macros, include paths, character set, and imports, with the libraries built into the compiler, and an English source read as the Hexicon it means. It gives preprocessed text; set_compile_mode makes it give tokens.