Files
c2/.github/copilot-instructions.md
T
2026-04-29 21:20:52 +02:00

47 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 `#include`ing 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 to see examples and documentation about the language.
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.