Skip to content

Initialize Cm project with HIR-aware compiler architecture#1

Merged
shadowlink0122 merged 5 commits intomainfrom
copilot/redesign-cb-repository
Dec 5, 2025
Merged

Initialize Cm project with HIR-aware compiler architecture#1
shadowlink0122 merged 5 commits intomainfrom
copilot/redesign-cb-repository

Conversation

Copy link

Copilot AI commented Dec 5, 2025

Cb language lacked HIR (High-level Intermediate Representation) in its design, limiting optimization and extensibility. This initializes Cm as a ground-up redesign with a modern compiler architecture.

Changes

  • Project structure following standard compiler layering:

    • src/frontend/ - lexer, parser, AST
    • src/middle/ - HIR, type checking, lowering
    • src/backend/ - interpreter (initial target)
  • Design documentation:

    • docs/design/architecture.md - compilation pipeline and phase responsibilities
    • docs/design/hir.md - HIR node definitions, desugaring examples, AST→HIR lowering

Compilation Pipeline

Source → Lexer → Parser → AST → Type Check → HIR → Interpreter

Key improvement: type checking completes before HIR generation, eliminating runtime type resolution overhead and enabling HIR-level optimizations (constant folding, DCE, inlining).

Original prompt

このプロジェクトはCbリポジトリのリニューアルです。
Cb言語ではHIRなどが考慮された設計ではなかったので、設計レベルで作り直します。
リポジトリの読み方はシーマイナーです


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: shadowlink0122 <34513120+shadowlink0122@users.noreply.github.com>
Copilot AI changed the title [WIP] Redesign Cb repository for better architecture Initialize Cm project with HIR-aware compiler architecture Dec 5, 2025
Copilot AI requested a review from shadowlink0122 December 5, 2025 09:33
@shadowlink0122 shadowlink0122 marked this pull request as ready for review December 5, 2025 12:10
@shadowlink0122 shadowlink0122 merged commit 68ca359 into main Dec 5, 2025
5 of 9 checks passed
@shadowlink0122 shadowlink0122 mentioned this pull request Feb 19, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants