FreeBASIC DevFbcParserToplevel
目次→FreeBASIC のハッキング→FreeBASIC でのハッキングのための情報→Top level parsing process←オリジナル・サイト
最上位の解析プロセス
fb.bas:fbCompile() は、入力ファイルごとに、fbc フロントエンドから呼ばれます。
ファイルの解析(そして、コンパイル)は、ここで始まります。
fb.bas:fbCompile()
- Open the input .bas
- Start the emitter (ir) (Open the output .asm)
- fbMainBegin() (Build the AST for the implicit main() or static constructor for module-level code)
- fbPreIncludes()
- fbIncludeFile() for every preinclude (found on the fbc command line)
- cProgram()
- fbMainEnd() (Close the implicit main())
- Finish emitting (ir) (Finish generating the .asm and close it)
- Close the input .bas
fb.bas:fbIncludeFile()
- Include file search
- lexPush() (Push a new lexer context to parse this #include file without disturbing the lexer's state in the parent file)
- Open the include file
- cProgram()
- Close the include file
- lexPop() (Restore the lexer state to the parent file)
parser-toplevel.bas:cProgram() is the root of the FB grammar, and parses a file. Here's a short & quick run down of what is done:
- cLine() repeatedly until EOF
- cLabel()
- cStatement()
- Declarations
- Compounds statements (IF/ELSE, DO/LOOP, EXIT/CONTINUE DO, ...)
- Procedure calls
- Function result assignments
- Quirk statements (special QB rtlib/gfxlib statements)
- ASM blocks
- Assignments
- Procedure pointer calls
and most of them use cExpression() at some point.
ページ歴史:2019-02-16 20:26:51
日本語翻訳:WATANABE Makoto、原文著作者:DkLwikki