自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (1)
  • 收藏
  • 关注

空空如也

c-minus词法分析器

C-Minus 的词法规则 (1)关键字: if else int return void while (2)专用符号: + - * / < >= == ~= = ; , ( ) [ ] { } /* */ (3)其他标记为 ID 和 NUM ,通过下列正则表达式定义: ID = letter letter* NUM = digit digit* letter = a|..|z|A|..|Z digit = 0|..|9 (4)空格由空白、换行符、制表符组成。 (5)注释由 /*...*/ 围起来,不能嵌套。 C-Minus 的语法规则 C-Minus 的 BNF 语法如下: 1. program -> declaration_list 2. declaration_list -> declaration_list declaration | declaration 3. declaration -> var_declaration | fun_declaration 4. var_declaration -> type_specifier ID; | type_specifier ID [ NUM ]; 5. type_specifier -> int | void 6. fun_declaration -> type_specifier ID ( params ) compound_stmt 7. params -> param_list | void 8. param_list -> param_list , param | param 9. param -> type_specifier ID | type_specifier ID [ ] 10. compound_stmt -> { local_declarations statement_list } 11. local_declarations -> local_declarations var_declaration | empty 12. statement_list -> statement_list statement | empty 13. statement -> expression_stmt | compound_stmt | selection_stmt | iteration_stmt | return_stmt 14. expression_stmt -> expression ; | ; 15. selection_stmt -> if ( expression ) statement | if ( expression ) statement else statement 16. iteration_stmt -> while ( expression ) statement 17. return_stmt -> return | return expression 18. expression -> var = expression | simple_expression 19. var -> ID | ID [ expression ] 20. simple_expression -> additive_expression relop additive_expression | additive_expression 21. relop -> <= | | >= | == | ~= 22. additive_expression -> additive_expression addop term | term 23. addop -> + | - 24. term -> term mulop factor | factor 25. mulop -> * | / 26. factor -> ( expression ) | var | call | NUM 27. call -> ID ( args ) 28. args -> arg_list | empty 29. arg8list -> arg_list , expression | expression 对以上每条文法规则,给出了相关语义的简短解释。 1. program -> declaration_list 2. declaration_list -> declaration_list declaration | declaration 3. dec

2020-04-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除