You are browsing as a guest. Sign up (or log in) to start making projects!

DotC

  • 1 Devlogs
  • 10 Total hours

DotC is a C compiler in C#(again), but this time I'm coming a bit more prepared.

Open comments for this post

10h 10m 6s logged

So, my last C compiler I forgot to install Wakatime 😅, so this is a revamp of the last C compiler, but I’m applying some knowledge to this one.

Now I kicked the whole thing off with a few different C# projects and scaffolded. The libraries I chose for this project are Pidgin, System.CommandLine, and Serilog.

For my first commit I already had some work done, but it was 3.6k LOC across 64 files and it had a working lexer with keyword/punctuator recognition and trivia handling. It had a recursive-descent parser with expression parsing, statement parsing, and declaration parsing. I had AST node types as C# records for expressions, operators, and statements with x86 MASM code generation with expression and statement lowering and a symbol table. I had a CLI with a few different flags and what not. And quite a few unit tests (generated by my pookie Claude) and yeah.

Now a little later(yesterday) I added if/else control flow with a IfStatement AST node with all sorts of things and else keyword and all sorts of things. Added a semantic analyzer to validate if-statement conditions and Boolean compat. Now last night I did have Claude go through and add some unit tests and cleanup the codebase, so removing unused using statements and cleanup the parser and remove warnings. Also orchestrated it to refactor a bit of the parser into a few different files instead of one big file and had it fix an issue with a diagnostic code being reused that was–well–wrong.

Now I will say the biggest pain in my butt has been naming conflicts with Pidgin, but that’s not too bad.

2
0
41

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…