📄 grammar.txt
字号:
FinC Grammar v0.4------------------------------------------------------------2003-5-03 ffxz: add support for class, object2003-5-02 ffxz: add support for OR, XOR ...2002-5-15 ffxz: add support for line parser grammar.2002-4-14 ffxz: begin the 0.3 version grammar.------------------------------------------------------------line_input -> empty | line_input line_startline_start -> decl_import | decl_global | decl_function | decl_struct | decl_package | statement_block | statement_expr | statement_for | statement_while | statement_ifinput -> empty | input declarationdeclaration -> decl_import | decl_global | decl_function | decl_struct | decl_package | decl_classdecl_global -> decl_variabledecl_local -> decl_variabledecl_variable -> type declaration_list ';' | type identifier '[' V_INT ']' ';' | type identifier '[' ']' ';'declarator_list -> declarator_list ',' declarator | declaratordeclarator -> identifier | identifier ASSIGN expr_assigndecl_struct -> STRUCT identifier '{' decl_field_list '}' ';'decl_field_list -> decl_field_declarator | decl_field_list decl_field_declaratordecl_field_declarator -> type struct_declarator_list ';' | type identifier '[' V_INT ']' | type identifier '[' ']'struct_declarator_list -> struct_declarator_list ',' struct_declarator | struct_declaratorstruct_declarator -> identifierdecl_function -> type identifier '(' decl_param_type_list ')' statement_blockdecl_param_type_list -> decl_param_list | decl_param_list ',' OPT_PARAMdecl_param_list -> empty | decl_param | decl_param_list ',' decl_paramdecl_param -> type identifier | type identifier '[' ']' | type identifier '[' V_INT ']'decl_import -> IMPORT V_STRING ';'decl_package -> PACKAGE V_STRING '{' decl_package_func_list '}' ';'decl_package_func_list -> decl_package_func | decl_package_func_list decl_package_funcdecl_package_func -> type identifier '(' decl_param_type_list ')' ';'decl_class -> class_head '{' decl_class_member_list '}' [;]class_head -> CLASS ID [:] [public] [class] class_scopeclass_scope -> ID | class_scope ':'':' IDdecl_class_member_list -> decl_class_class_member | decl_class_member_list decl_class_memberdecl_member -> decl_class_attrib | decl_class_method | decl_classdecl_class_attrib -> access-specifier decl_variabledecl_class_method -> access-specifier type identifier '(' decl_param_type_list ')' statement_block | virtual access-specifier type identifier '(' decl_param_type_list ')' statement_block | virtual access-specifier type identifier '(' decl_param_type_list ')' '=' '0' ';'access-specifier -> PUBLIC | PRIVATEtype -> type_list | class_scopetype_list -> type_basic | type_list type_basictype_basic -> VOID | CHAR | SHORT | INT | STRING | POINTER | FLOAT | DOUBLE | LONG | BOOL | STATIC | UNSIGNED | CONSTidentifier -> IDENTIFIERliteral -> V_STRING | V_CHAR | V_INT | V_FLOAT | V_LONG | V_TRUE | V_FALSE | V_NULLexpr -> expr_assign | expr ',' expr_assignexpr_assign -> expr_condition | expr_unary ASSIGN expr_assignexpr_condition -> expr_logic_or | expr_logic_or '?' expr ':' expr_conditionexpr_logic_or -> expr_logic_and | expr_logic_or OR expr_logic_andexpr_logic_and -> expr_equality | expr_logic_and AND expr_equalityexpr_inclusive_or -> expr_exclusive_or | expr_inclusive_or '|' expr_exclusive_orexpr_exclusive_or -> expr_and | expr_exclusive '^' expr_andexpr_and -> expr_equality | expr_and '&' expr_equalityexpr_equality -> expr_relational | expr_equality EQ expr_relational | expr_equality NE expr_relationalexpr_relational -> expr_shift | expr_relational '<' expr_shift | expr_relational '>' expr_shift | expr_relational LE expr_shift | expr_relational GE expr_shiftexpr_shift -> expr_additive | expr_shift '<<' expr_additive | expr_shift '>>' expr_additiveexpr_additive -> expr_multiplicative | expr_additive SUB expr_multiplicative | expr_additive ADD expr_multiplicativeexpr_multiplicative -> expr_cast | expr_multiplicative '*' expr_cast | expr_multiplicative '/' expr_cast | expr_multiplicative '%' expr_castexpr_cast -> expr_unary | '(' type ')' expr_castexpr_unary -> expr_postfix | ADD expr_cast | INC expr_cast | SUB expr_cast | DEC expr_cast | NOT expr_cast | '~' expr_cast | ADDR_OF '(' expr_unary ')' | VALUE_OF '(' expr_unary ')' | NEW expr_postfix -> expr_primary | expr_postfix '[' expr ']' | expr_postfix INC | expr_postfix DEC | expr_postfix '.' identifier | expr_postfix '(' param_list ')'expr_primary -> literal | '(' expr ')' | identifier | '::' identifier | SELFparam_list -> empty | expr_assign | param_list ',' expr_assignstatement -> decl_local | statement_block | statement_expr | statement_return | statement_for | statement_while | statement_if | statement_continue | statement_break | statement_switchstatement_in_block -> decl_local | statement_block | statement_node | statement_return | statement_for | statement_while | statement_if | statement_switchstatement_block -> '{' statement_list '}'statement_list -> statement_in_block | statement_list statement_in_blockstatement_expr -> ';' | expr ';'statement_return -> RETURN expr ';'statement_for -> FOR '(' statement_node statement_node expr ')' statementstatement_while -> WHILE '(' expr ')' statementstatement_if -> IF '(' expr ')' statement statement_if_elsestatement_if_else -> empty | ELSE statementstatement_continue -> CONTINUE ';'statement_break -> BREAK ';'statement_switch -> SWITCH '(' expr ')' statement_casestatement_case -> CASE expr ':' statement_list | DEFAULT ':' statement_list
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -