Zen
A cross-platform functional programming language
|
Zen compiler class implementation. More...
Public Member Functions | |
Impl (const Build::Config &cfg, Compiler &compiler) | |
Default constructor. | |
~Impl () | |
Destructor. | |
void | importHeader (zbl::ParseContext &pctx, const z::stringlist &idList, const Ast::ImportStatement::Type &type) |
Import a header file. | |
void | compile (const Build::Project &project) |
Compile a project. | |
void | readProject (Ast::Unit &unit, const z::string &file) |
Read a project file. | |
Private Member Functions | |
void | pumpLexer (zbl::Scanner &scanner, zbl::Lexer &lexer, zbl::Parser &parser) |
Read tokens from lexer and push into parser. | |
void | pumpParser (z::stream &stream, zbl::ParseContext &pctx) |
Initialize scanner,lexer and parser and process inputs. | |
z::string | getImportFilename (const z::stringlist &idList) |
Get the import header file name, given an id list. | |
void | importHeaderStream (z::stream &os, const z::string &fname, zbl::ParseContext &pctx, const Ast::TypeDefTypeSpec::NativeType &ntype) |
Import a header, given an input stream. | |
void | importHeaderString (zbl::ParseContext &pctx, const char *name, const char *hdrstr, const Ast::TypeDefTypeSpec::NativeType &ntype) |
Import a header, given an input string. | |
void | importNativeHeader (zbl::ParseContext &pctx) |
Import all native headers. | |
int | doParse (Ast::Unit &unit, z::stream &stream, const z::string &filename) |
Import a header, given an input string. | |
Private Attributes | |
const Build::Config & | _cfg |
Configuration to build against. | |
Compiler & | _compiler |
Outer Compiler instance. |
Zen compiler class implementation.
Holds the parser, lexer, parsecontext.
Impl | ( | const Build::Config & | cfg, |
Compiler & | compiler | ||
) | [inline] |
Default constructor.
cfg | Configuration to build against |
compiler | Outer Compiler instance |
void compile | ( | const Build::Project & | project | ) | [inline] |
Compile a project.
project | The project definition |
Import a header, given an input string.
unit | The AST Unit to read into |
stream | The input stream |
filename | The name of the file to read |
z::string getImportFilename | ( | const z::stringlist & | idList | ) | [inline, private] |
Get the import header file name, given an id list.
Checks that the file exists
idList | The id list |
void importHeader | ( | zbl::ParseContext & | pctx, |
const z::stringlist & | idList, | ||
const Ast::ImportStatement::Type & | type | ||
) | [inline] |
Import a header file.
pctx | The parser context |
idList | The header name, as a list of strings |
type | The header type |
void importHeaderStream | ( | z::stream & | os, |
const z::string & | fname, | ||
zbl::ParseContext & | pctx, | ||
const Ast::TypeDefTypeSpec::NativeType & | ntype | ||
) | [inline, private] |
Import a header, given an input stream.
os | The input stream |
fname | The import filename |
pctx | The parser context |
ntype | The native type of the import header |
void importHeaderString | ( | zbl::ParseContext & | pctx, |
const char * | name, | ||
const char * | hdrstr, | ||
const Ast::TypeDefTypeSpec::NativeType & | ntype | ||
) | [inline, private] |
Import a header, given an input string.
pctx | The parser context |
name | The import name |
hdrstr | The header string |
ntype | The native type of the import header |
void importNativeHeader | ( | zbl::ParseContext & | pctx | ) | [inline, private] |
Import all native headers.
pctx | The parser context |
void pumpLexer | ( | zbl::Scanner & | scanner, |
zbl::Lexer & | lexer, | ||
zbl::Parser & | parser | ||
) | [inline, private] |
Read tokens from lexer and push into parser.
scanner | The scanner |
lexer | The lexer |
parser | The parser |
void pumpParser | ( | z::stream & | stream, |
zbl::ParseContext & | pctx | ||
) | [inline, private] |
Initialize scanner,lexer and parser and process inputs.
stream | The input stream |
pctx | The parser context |
Read a project file.
unit | The AST to read the project into |
file | The name of the file to read |