The compiler is built on several basic modules. Each of the modules corresponds to some concept. The following sections gives brief descriptions. Click on the caption to view the concepts or go to the API/interface links to see programming details.
Top-level compilation modules
- PARSER [ Concepts | API | Implementation ] Compilation of any code requires to split the source into tokens and then group them into syntax phrases. These two processes are called tokenizaiton and parsing.
- COMPILER [ Concepts | API | Implementation ] Compiler is the module which converts abstract syntax tree produced by the parser into machine code which can be executed, or into an executable file.
Atom management modules
- ATOMS [ Concepts | API | Implementation ] Atoms are the core memory unit used to hold all types of Logo values. Atoms have fixed size. Allocation and deallocation of atoms is entirely OS-independent.
- NUMBERS [ Concepts | API | Implementation ] Numbers are special kinds of atoms which hold either integer or floating-point number.
- WORDS [ Concepts | API | Implementation ] Words are atoms which keep a link to text. There are two types of words - real words and subwords.
- LISTS [ Concepts | API | Implementation ] Atoms can be chained in lists. List atoms represent the nodes of these chains.
- VARIABLES [ Concepts | API | Implementation ] Variables play a central role in Lhogho as long as they represent all primitive and user-defined variables, functions, commands and operators. Variables can be nested thus providing a mechanism for hierarchy.
- ERRORS [ Concepts | API | Implementation ] Errors are stored in atoms. Lhogho attempts to report error possition as precisely as it is possible. Many compiler's functions which return atoms may also return error atoms in case of error.
Code-generation modules
- ASM [ Concepts | API | Implementation | i386 ] Asm is the module which contains routines fr creating processor-dependent machine code.
- RUNTIME [ Concepts | API | Implementation ] Runtime module contains the implementation of the primitives.
- EXTERNAL [ Concepts | API | Implementation ] This module supports the interface between Lhogho and other programming languages - conversion from Logo datum to C-like datum (and vice versa), calling functions written in another language and calling Logo functions from functions in another language.
Utility modules
- POOLS [ Concepts | API | Implementation ] The compiler is a system of tightly integrated modules. Pools implement a low-level memory manager mechanism which stands between the rest of the compiler and the operating system.
- TRANSLATION [ API ] Lhogho messages and primitives can be localized to any language by translating the texts in the translate.h file and rebuilding the compiler. The same file containt the texts for the compiler options, so they can be changed too.
- UNICODE [ API I Implementation ] To support proper translation especially in languages with non-latin alphabets Lhogho accepts both ASCII and UNICODE source files. In UNICODE mode the compiler manages internally all texts (including var names) as UNICODE strings.
- GLOBALS [ API ] Every project has some global definitions which control how it works. Lhogho globals determine in what mode to compile the compile and what features to include in it.
- OPTIONS [ Concepts | API | Implementation ] The options module controlls the options which can be passed to the compiler. These options control what to do and what not to do.
Tester modules
- TEST MAKER [ Concepts | API | Implementation ] The main module. Contains initializing functions and calls workers.
- ERROR [ API ] Some defines usefull for error handling and debuging.
- INTERNAL [ API ] Basic prototypes and declarations of internal helper functions used from tester application.
- PARAM PARSERS [ Concepts | API | Implementation ] This file contains definitions of funcions which parse one configuration parameter line from the test file. Here will be added code when new options are introduced.
- PROCESS FILE [ Implementation ] Contains functions that is called when a test file is processed. Main workers are here.
- STRING FUNCTIONS [ Implementation ] Some usefull helpers for string processing.
- TESTER INTERNAL [ Implementation ] Implementation of functions called from main worker functions and test file parsing methods.