Files
c2/.github/copilot-instructions.md
T
2026-04-29 10:59:06 +02:00

1.7 KiB
Raw Blame History

C2

C2 is a compiler for a new language. See the README.md for information about this project.

Code Changes

After every code change, ensure the binary builds correctly, and run the unit tests (make test).

Ensure that every new function and code path has useful unit tests.

Creating Source Files

Whenever a new source file is created, it must be added to the include.mk file. A test file should also be created.

Test source files do not have to be added to the include.mk file. These are added to the test.c file by means of directly #includeing the C file.

Testing

Any test source code must be prefixed with test_xyz, where xyz matches the source file it is trying to test. For instance, a test for buffer.c must be called test_buffer.c.

There will be no test_buffer.h. Instead, test.c will directly #include the Csource-file directly.

Every syntax error path identified in the parser MUST have a corresponding test.

Language Syntax

Since this is a compiler for a new language, do not assume anything of its syntax. Always check the specs directory.

If there is anything unclear, ask the user for clarification. It is certainly possible that there are contradictions in the spec that have to be solved first.

Comitting

Often, the user modifies an interface (typically in a header file), and then asks the agent to update the implementation.

When creating a commit, make sure that both the user's and the agent's modifications are included in the commit.

Only create a commit when specifically asked for that. Never assume implicitly that the user wants you to create a commit. Even if they asked you to create a commit in an earlier task, it does not mean that you should also create a commit in a later task.