seeseemelk 49b9db5b75 Refactor token mapping: use keyword map for tokenization instead of strcmp
- Created KeywordMap structure with keyword-to-token mapping at top of token.c
- Added lookup_keyword() function to check if identifier is a keyword
- Replaced 3 strcmp calls (lines 99-101) with single lookup_keyword() call
- Removed token_to_string() function and its tests (3 tests removed)
- Single easy-to-read and modify keyword map serves both documentation and implementation
- Added new keywords by editing the keywords[] array at top of token.c

All 12 tests passing (removed token_to_string tests which are now unnecessary).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 09:44:19 +02:00
2026-04-24 09:29:53 +02:00
2026-04-24 09:29:53 +02:00
2026-04-24 09:29:53 +02:00
2026-04-24 09:29:53 +02:00
2026-02-25 15:38:32 +01:00
2026-04-24 09:29:53 +02:00
2026-04-24 09:29:53 +02:00

C2

C2 is a programming language based on C. It adds modern high-level features such as metaprogramming, generics, etc, but compiles down to C89.

Building

To build the c2compiler, simply run make or make all. This will build the compiler and run the tests.

In order to only build the compiler, run make c2. In order to run the tests, run make test.

Versioning

The current version is v0. Its source code lives in the v0 directory.

Languages Specifications

See the specs directory for information on the actual language syntax.

S
Description
No description provided
Readme 339 KiB
Languages
C 96.5%
Makefile 3.5%