aboutsummaryrefslogtreecommitdiffhomepage
path: root/c/lex.c
Commit message (Collapse)AuthorAgeFilesLines
* cpp: allow comments between function-like macro name and argumentslemon2026-02-261-8/+27
|
* preprocessor: use shared static buffers for replacement listslemon2026-02-251-150/+178
| | | | | | | One for macro definitions' bodies, another one for function-like macros with substituted arguments in the macro expansion stack. Cuts down on a lot of individual allocations. #undef'd macros' replacement lists are "leaked" but that is very minor
* fix various warningslemon2026-02-241-1/+1
|
* diagnostics: also print #include provenance for warningslemon2026-02-241-1/+2
|
* cpp: fix __has_builtinlemon2026-02-231-2/+8
|
* cpp: add __COUNTER__ macrolemon2026-02-231-131/+172
|
* preprocessor: fix an edge case with erroneously recursive macro expansionlemon2026-02-221-26/+42
|
* cpp: better diagnosticslemon2026-02-211-13/+40
|
* cpp: add __VA_OPT__ and comma ## __VA_ARGS__ pastinglemon2026-02-061-5/+40
|
* c: GNU __attribute__ stubslemon2026-01-251-0/+1
|
* driver: -iquote, -isystem, etclemon2026-01-121-15/+27
| | | | With GCC-like search order
* cpp: prioritize internal headers over system headerslemon2026-01-101-6/+6
|
* Add version tracking. Starting at 0.1.0lemon2026-01-091-4/+14
|
* cpp: fix pasting ident+keywordlemon2026-01-091-4/+7
|
* lexer: multibyte escape seqs in wide character literallemon2026-01-091-4/+13
| | | | (hacky)
* cpp: fix multiline comment in skipped preprocessor directivelemon2026-01-091-2/+16
|
* cpp: fix single-line comment after preprocessor directivelemon2026-01-091-1/+1
| | | | It was eating up the newline token
* cpp: nicer handling of predefined macroslemon2025-12-291-40/+29
|
* backend: start implementing aarch64lemon2025-12-281-0/+4
|
* preprocessor make some errors just warningslemon2025-12-221-4/+6
|
* c: Fix some dumb uses of initialized stufflemon2025-12-221-3/+7
| | | | | | Can't figure out what's wrong with the change to struct expr from 9721d6ba40 but it makes valgrind complain and causes miscompilation of the compiler itself..
* c: keyword aliaseslemon2025-12-211-4/+17
| | | | | Some linux headers use __signed__ for whatever reason.. this is a general fix for those alternate keyword
* lexer: more small optimizationslemon2025-12-211-14/+33
|
* lexer: note source of #include when error occurs in #included filelemon2025-12-201-0/+6
|
* c: support CRLF newlineslemon2025-12-201-3/+11
|
* lexer: fix remnant use of TKEOF for characterlemon2025-12-201-9/+7
|
* optimize lexer a bit morelemon2025-12-201-60/+86
|
* lexer: convert pp-idents to keywords only after preprocessinglemon2025-12-201-63/+65
|
* cpp: GNU extension for named variadic argumentslemon2025-12-181-4/+7
|
* cpp: better error recovery for #define syntax errorlemon2025-12-181-6/+7
|
* nicer defaults and facilities for cross-compilationlemon2025-12-171-2/+16
|
* create distinct interned string typelemon2025-12-151-22/+21
| | | | | | | | | | | | | | Interned strings are used pervasively, so it's a good idea to add a layer of type safety to differentiate them from general cstrs and avoid potential bugs from comparing non-interned and interned strings. Not that that's happened so far that I can remember, but it could. I'm 90% sure it's legal to alias `struct {char c;}` pointers with `char` pointers. This specific typedef gives type safety but with a simple one-way `internstr -> const char *` typecast (with `&istr->c`). Converting the other way around is more intentional: a straight up cast `(internstr)cstr` which sticks out as unchecked and probably wrong, or calling the intern(cstr) function, which is the right way.
* move intern() to mem.clemon2025-12-151-45/+0
| | | | | Being in lex.c was vestigial, since it was being used all over the frontend and backend.
* lex: loop with goto instead of tail recursionlemon2025-12-151-7/+8
| | | | | This uncovered a edgecase with loops and lifetime construction in regalloc!
* lexer: use a hashmap to lookup keywordslemon2025-12-151-27/+27
|
* cpp: support #line directiveslemon2025-12-141-10/+75
|
* cpp: correctly handle extra tokens after directiveslemon2025-12-141-16/+21
|
* s/amd64/x86_64/lemon2025-12-121-1/+1
|
* lex: use pmap for macro lookuplemon2025-12-121-125/+69
| | | | To reduce hashmap code repetition. Also add pmap_del for this purpose
* rename arraylength macro -> countoflemon2025-12-111-20/+20
|
* -trigraphs optionlemon2025-12-111-3/+3
|
* lex/expr(): cleanuplemon2025-12-111-29/+29
|
* lexer: properly add padding for cpppredefslemon2025-12-101-2/+2
|
* lex: make some hashtables resizablelemon2025-12-091-29/+67
| | | | Was hiting the fixed limits trying to preprocess sqlite3amalgamation
* add command-line predefined macros (-D, -U)lemon2025-12-061-4/+52
|
* cpp: implement preprocessor expressions short circuiting behaviourlemon2025-12-031-17/+23
| | | | This only affects whether an error is given for something like `0 && 0/0` (it shouldn't)
* preprocessor: add #ifndef...#endif include guard optimizationlemon2025-12-021-11/+27
|
* lex: remove some hacks and optimize preprocessorlemon2025-11-281-39/+34
|
* pp: fix token pasting (hopefully)lemon2025-11-241-27/+15
|
* lex: TEMP hack: #define __x86_64__ or some system headers break subtlylemon2025-11-231-0/+1
|