Compiler Source Code:
The code is now split into the following parts:
thinBasicOxygen
modular interface for thinBasic.
thincore
Header for creating thinBasic modules in FreeBasic.
oxygen
Oxygen main with dll exportable functions.
o2assm
Assembler which translates assembly code into oxygen script.
o2keyw
Oxygen primary keywords, intrinstic macros and functions.
o2enco
Encoder: translate phrases to Assembler and o2
o2fini
Adds prolog and epilog code for Basic and headers for PE files.
o2link
The original oxygen machine code renderer / linker.
o2glob
Structures, constants,macros, global variables.
o2lexi
Lexing and parsing functions.
o2meta
Metacommands: evaluating constants and selecting code blocks
o2pars
Parsing: lower translation functions.
o2reso
PE file resources encoding (not operational yet).
o2runt
Runtime procedures used by compiled programs.
o2decl
Declarations dims enumerations.
o2expr
Expressions including operator precedence.
o2sema
Preprocessor / compiler translating high level code.
HIERARCHY:
thinBasic_Oxygen is a modular shell for Oxygen so it can be used in thinBasic.
Oxygen is the library level containing all the functions for compiling, linking and executing.
O2Sema performs the top level translation of Basic and macros into Assembly code.
O2Decl records types and classes, and maps dimmed variables.
O2Expr handles expressions including operator prececedence
O2Enco turns operators,operands and procedures into Assembly code.
O2Par parses, identifies and classifies words, also expanding macros.
O2Lex reads words, symbols and identifies lines and nested block structures.
thinbasicOxygen-->Oxygen-->o2Sema-->o2Decl+o2Expr-->o2Enco-->o2Par-->o2Lex
COMPILING STAGES:
Basic and Macros are converted to Assembly code.
Prologs, epilogs, PE headers and sections are added.
Assembly code is converted to Oxygen script.
Oxygen script is converted to binary and linked.
The executable binary image is then (optionally compacted into a PE file.
o2Sema-->o2fini-->o2Assm-->o2Link-->(makeEXE/DLL)
HOW TO COMPILE:
compiling from the freebasic console: (FreeBasic 0.20.0)
This compels the GNU linker to use DllMain as the entry point
fbc thinBasic_Oxygen.bas -dll -Wl -e,_DllMain
(previous method)
fbc -dylib thinBasic_Oxygen.bas
Bookmarks