{"id":13613488,"url":"https://github.com/thufv/CMinor-Verifier","last_synced_at":"2025-04-13T15:33:15.542Z","repository":{"id":53896148,"uuid":"521112738","full_name":"thufv/CMinor-Verifier","owner":"thufv","description":"2022 年春季学期清华大学《软件分析与验证》课程实验平台 (Lab for Software Analysis and Verification, 2022 Spring, Tsinghua University)","archived":false,"fork":false,"pushed_at":"2025-03-10T17:38:09.000Z","size":1375,"stargazers_count":205,"open_issues_count":0,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T17:27:51.562Z","etag":null,"topics":["course-project","program-verification"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thufv.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-04T03:41:54.000Z","updated_at":"2025-03-27T11:59:39.000Z","dependencies_parsed_at":"2022-08-13T03:40:14.367Z","dependency_job_id":null,"html_url":"https://github.com/thufv/CMinor-Verifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thufv%2FCMinor-Verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thufv%2FCMinor-Verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thufv%2FCMinor-Verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thufv%2FCMinor-Verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thufv","download_url":"https://codeload.github.com/thufv/CMinor-Verifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248736211,"owners_count":21153551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["course-project","program-verification"],"created_at":"2024-08-01T20:00:48.286Z","updated_at":"2025-04-13T15:33:15.534Z","avatar_url":"https://github.com/thufv.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"![](logo.jpeg)\n\n## 简介\n\n本项目为 2022 年春季学期清华大学《软件分析与验证》课程实验平台，作业平台提供了一个 CMinor 的验证框架，你需要在其中实现核心的验证算法。CMinor 是一个面向验证的教学语言，其包括源程序和验证标注两部分，其中源程序部分大致是 C 语言的子集，验证标注部分大致是 [ACSL (ANSI/ISO C Specification Language)](https://frama-c.com/html/acsl.html) 的子集。从 C 语言的角度来看，验证标注是写在注释中的，不会影响 C 代码通常的编译和运行。\n\n在本实验中你需要实现本工具中的核心验证算法部分，具体的说明请见[任务说明文档](task-doc.md)。\n\n本项目使用 [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) 来集成公开测例仓库，在 clone 后可以使用 `git submodule update --remote` 来更新测例仓库。\n\n## 安装\n\n本项目依赖于 .NET 6，你可以从[这里](https://dotnet.microsoft.com/download)下载其最新的 SDK。\n\n你可以使用任意你喜欢的 IDE，我们推荐：\n- [Visual Studio 2022 (\u003e= 17.0.0)](https://visualstudio.microsoft.com/)：可以在安装的时候打包安装 .NET 的 SDK，不需要再单独下载\n- [Visual Studio Code](https://code.visualstudio.com/)：配合 [C# 插件](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)\n- [Rider](https://www.jetbrains.com/rider/)\n\n\u003e 注意：建议不要通过 `homebrew` 或 `apt` 直接安装，因为其软件源中的 dotnet 的版本很有可能是过时的。建议从[这里](https://dotnet.microsoft.com/download)下载最新版。\n\n\u003e 注意：如果你遇到了错误 `Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libz3' or one of its dependencies.`，那么你需要从[这里](https://github.com/Z3Prover/z3/releases/tag/z3-4.8.16)单独安装 Z3 4.8.16。\n\n## 使用\n\n为了使用在线评测功能，你需要先 fork 本仓库。\n\n本项目基本的运行方法是在根目录下运行以下指令：\n\n```bash\ndotnet run -- --source \u003cpath\u003e\n```\n\n你可以使用 `--printCFG` 来打印出得到的 CFG。\n\n所支持的各命令行选项的具体含义为：\n\n```bash\n--source      Required. The source file of CMinor language (recommended with filename extension '.c').\n\n--printCFG    The file (or 'console') to which the control flow graph is printed.\n\n--help        Display this help screen.\n\n--version     Display version information.\n```\n\n## 评测方式\n\n我们不再使用传统的 OJ 来提交代码，而是用 [GitHub Actions](https://github.com/features/actions) 将自动化测试直接集成进项目中。\n简而言之，你的每一次 push 都相当于自动提交了代码，会触发一个名为 `Build and Test` 的 job，其会构建项目并评测所有测例，其得分（百分制）为：\n\n![Error when building and testing](https://byob.yarr.is/thufv/CMinor/score)\n\n\u003e 注1：请在 fork 后将上面的 URL 中的 `thufv` 替换为你的用户名。\n\n\u003e 注2：以上显示的得分需要等待每次 push 所触发的 GitHub Action 执行完毕后才会被更新。\n\n\n## 结构\n\n该编译器的设计可以分为三个部分：\n\n * 前端（frontend）：使用由 [ANTLR](https://www.antlr.org/) 自动生成的 parser 将源文件解析为 CST (concrete syntax tree，具体语法树)，再遍历 CST，生成 CFG（control flow graph，控制流图）；\n * 中间表示（ir）：面向验证来设计的控制流图；\n * 后端（backend）：使用 deductive verification 的方法从 CFG 中生成验证条件（verification condition），再将其喂给 SMT Solver 来求解。\n   * 这部分是你需要来实现的。\n\n你唯一被允许修改、并且你也必须要修改的文件是 `Verifier.cs`，你需要在其中实现演绎验证的算法主体。\n\n## API 文档\n\n如需阅读 API 文档，你可以使用 [doxygen](https://www.doxygen.nl/index.html)，在本项目根目录下运行 `doxygen` 即可生成。\n\n所生成的 API 文档在 `./api-doc/`，打开 `./api-doc/index.html` 即可浏览。\n\n## 贡献者\n\n * [谢兴宇](https://github.com/namasikanam)\n * [陈建辉](https://www.zhihu.com/people/yan-jing-ye-35)\n * [徐荣琛](https://xurongchen.github.io/)\n * [刘江宜](https://github.com/panda2134)\n * [孙志航](https://www.pixiv.net/users/73044167)\n * [贺飞](https://feihe.github.io/)\n\n## 参考\n\nCMinor 语言大致是以下语言标准的子集：\n\n- Standard C: [ISO/IEC 9899:2018, aka C17 or C18](https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf)\n- ANSI/ISO C Specification Language: [ACSL v1.17](https://frama-c.com/download/acsl-1.17.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthufv%2FCMinor-Verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthufv%2FCMinor-Verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthufv%2FCMinor-Verifier/lists"}