Skip to content

Commit

Permalink
Implement macros defined in <stdbool.h> (#124)
Browse files Browse the repository at this point in the history
Macro 'bool', 'true', 'false' are defined in c.c. In addition, this
commit also tweaks 'define' preprocessor directive so that parsing
identifier after 'define' is possible.

The size of type _Bool is same as char type, which takes 1 byte.

Notice that currently lexer aliasing is unreliable due to the token
type determination algorithm does not correctly recognize T_identifier
and T_string at this moment.

Close #122
  • Loading branch information
ChAoSUnItY committed Mar 27, 2024
1 parent 7f328f3 commit 5979cb8
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 112 deletions.
4 changes: 4 additions & 0 deletions lib/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

#define NULL 0

#define bool _Bool
#define true 1
#define false 0

#if defined(__arm__)
#define __syscall_exit 1
#define __syscall_read 3
Expand Down
Loading

0 comments on commit 5979cb8

Please sign in to comment.