修复内容:
1. ast.rs: 恢复原始字段名 ty: Type(而非 type_: TypeAnnotation)
- 添加 name/version/description 字段到 Clause
- 添加 description 字段到 Obligation
- 添加 tests 字段到 Program
- 添加 Expression::Raw 变体
- 添加 ObligationFrequency::Display 实现
- 添加 Literal::Display 实现
2. parser/mod.rs: 完全重写,基于原始版本添加新字段支持
- 支持 name:/version:/description: 字段解析
- 支持 test "..." { assert ... } 测试块解析
- 支持 obligation { description: ... } 字段
3. 修复所有模块的编译错误:
- codegen/bytecode_generator.rs
- semantic/type_checker.rs
- semantic/scope_resolver.rs
- semantic/obligation_validator.rs
- verification/constraint_generator.rs
4. 新增 cnnl-service HTTP 服务:
- POST /api/v1/compile - 编译 CNNL 源代码
- POST /api/v1/parse - 解析 CNNL 源代码(返回 AST)
- POST /api/v1/validate - 验证 CNNL 语法
- GET /api/v1/health - 健康检查
- GET /api/v1/version - 版本信息
- 监听端口 8765,已部署为 systemd 服务
测试结果:26/26 通过
关联 Issues: #64 #65
|
||
|---|---|---|
| .. | ||
| mod.rs | ||
| obligation_validator.rs | ||
| scope_resolver.rs | ||
| type_checker.rs | ||