{"id":19111944,"url":"https://github.com/f-ca7/mycmminterpreter","last_synced_at":"2026-06-18T02:31:57.923Z","repository":{"id":107864522,"uuid":"228508431","full_name":"F-ca7/MyCMMInterpreter","owner":"F-ca7","description":"Interpreter for C--","archived":false,"fork":false,"pushed_at":"2019-12-17T01:37:35.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T11:30:44.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/F-ca7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-17T01:36:59.000Z","updated_at":"2019-12-17T01:37:41.000Z","dependencies_parsed_at":"2023-03-25T16:05:00.941Z","dependency_job_id":null,"html_url":"https://github.com/F-ca7/MyCMMInterpreter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/F-ca7/MyCMMInterpreter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F-ca7%2FMyCMMInterpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F-ca7%2FMyCMMInterpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F-ca7%2FMyCMMInterpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F-ca7%2FMyCMMInterpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/F-ca7","download_url":"https://codeload.github.com/F-ca7/MyCMMInterpreter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F-ca7%2FMyCMMInterpreter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34474063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T04:30:44.567Z","updated_at":"2026-06-18T02:31:57.903Z","avatar_url":"https://github.com/F-ca7.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## My CMM Interpreter\n\n### 词法测试\n\n-------\n\n1. test_lex_err1.cmm 第三行，标识符以数字开头错误\n2. test_lex_err2.cmm 第二行，非法字符\n3. test_lex_err3.cmm 第二行，非法字面量 两个小数点\n4. test_lex_err4.cmm 第二 三行，注释未闭合 多个错误 \n\n通过lex_1~6的测试\n1. 测试注释\n2. 数字字面量\n3. 各种符号\n4. 标识符\n5. 关键字\n6. 综合 全部正确\n\n\n### 语法测试\n\n---------\n\n1. test_gram_1.cmm 正确， 为expr2_test.txt的**no4.测试**和**f测试**, \n以及extended的**number format**和**identifier format** 以及 **function**\n1. test_gram_err1.cmm 第三行，if的条件语句没有右括号\n2. test_gram_err2.cmm 第三行，算术表达式错误，缺少分号错误，\n缺少右括号错误，算术表达式括号不匹配，缺少返回语句；多个错误\n3. test_gram_err3.cmm 字面量不能作为左值\n4. test_gram_err4.cmm 未定义函数\n#### 错误恢复\n1. 跳过BeginSym和EndSym之外的符号；\n2. 若遇到BeginSym，开始新的识别；若遇到EndSym结束。\n\nif和while的条件不能为数字。\n\n```\n文法:\n# program -\u003e stmt-sequence\n\nprogram -\u003e func-sequence\nfunc-sequence -\u003e function func-sequence\nfunction -\u003e func identifier ( arg-list ) ret-value stmt-block\nret-value -\u003e void | int | real | char \n\nstmt-sequence -\u003e statement ; stmt-sequence | statement | ε\nstatement -\u003e declare-stmt | assign-stmt | if-stmt | while-stmt | print-stmt | scan-stmt\n\nstmt-block -\u003e { stmt-sequence }\n\nif-stmt -\u003e if ( rel-exp ) stmt-block | if ( rel-exp ) stmt-block else stmt-block | if ( rel-exp ) stmt-block\n        else-ifs\nelse-ifs -\u003e else if ( rel-exp ) stmt-block else-ifs | else stmt-block | else if ( rel-exp ) stmt-block\n\nwhile-stmt -\u003e while ( rel-exp ) stmt-block\n\nassign-stmt -\u003e variable = exp ;\nprint-stmt -\u003e print exp ;\n\n# 可以同时赋值或者不赋值\ndeclare-stmt -\u003e (int | real | char) ((identifier [ = exp ]) | (identifier [ exp ])) ;\n\nvariable -\u003e identifier [ [ exp ] ]\n\nexp -\u003e  exp\nrel-exp -\u003e exp logical-op exp\nexp -\u003e term add-op exp | term\nterm -\u003e factor mul-op term | factor\n\nfactor -\u003e ( exp ) | number | variable | add-op exp\n\nlogical-op -\u003e \u003e | \u003c | \u003e= | \u003c= | \u003c\u003e | ==\n\nadd-op -\u003e + | -\nmul-op -\u003e * | /\n```\n\n1. 没有函数重载：\n    Method dispatch is simplified if it doesn't need to do type matching \n    as well.\n    在Go语言里面，函数名称的唯一性规定是为了让程序看起来简洁明了\n2. 函数不支持 嵌套， 重载和默认参数\n3. 定义函数使用关键字func，对于函数指针来说 阅读方便理解\n    int (\\*(\\*fp)(int (\\*)(int, int), int))(int, int) \n    \u003cbr\u003e\n    f func(func(int,int) int, int) func(int, int) int\n    \n### 语义测试\n\n--------\n中间代码格式：\n```\njne,条件,null,目标\njmp,null,null,目标\nprint,变量,null,null\nscan,变量,null,null\nin,null,null,null\nout,null,null,null\nint,右值,null,左值\nreal,右值,null,左值\nint,长度,null,数组名\nreal,长度,null,数组名\nassign,右值,null,左值\nplus,第一个操作数,第二个操作数,目标\narr_acc,数组名,索引,临时变量名\narg,参数值,null,null\ncall,函数名,null,null\nret,null,null,null\n```\n1. test_sem_err1 检查语义期间错返回值类型匹配错误\n2. test_sem_err2 检查语义期间除以0错误\n\n3. test_opt_1 中间代码优化-if-elseif-else的常量判断优化\n4. test_opt_2 赋值但未使用的变量优化\n### 解释执行测试\n\n---------\n1. test_func 成功 基础综合，包括输入输出、if、while、算术表达式(负号, 类型隐式转换) 数组的输出 while中的break\n2. test_func_1 成功 字符输出 数组默认值\n3. test_func_err1 报告错误 运行期间数组上下界检查\n4. test_func_err2 错误 变量的重定义\n5. test_func_err3 错误 变量的未声明\n6. test_func_call1 成功 函数调用 局部变量不会影响 入参 和 返回值\n7. test_func_call2 成功 函数的递归调用\n\n### feat:\n\n1. 检查符号、变量是否声明\n2. 执行期间数组越界 上下界检查\n3. 控制台输入输出\n4. 实现6个比较运算符\n5. 实现char类型的赋值、输出\n6. 实现算数表达式负号的检测\n7. 实现函数词法、语法、语义\n8. 语义分析检查函数返回值类型\n9. 函数调用(包括递归)\n10. 中间代码优化(包括if的常量判断、声明但未使用的变量检测)\n11. 可视化界面展示语法树，可选择是否代码优化\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-ca7%2Fmycmminterpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff-ca7%2Fmycmminterpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-ca7%2Fmycmminterpreter/lists"}