How iamzhz/ababiu works
Project type and purpose
• This is a compiler for a toy programming language called “Ababiu.”
• It reads .abb source files, lexes them, parses into an AST/IR, performs semantic analysis and transformations, generates x86-64 assembly, then relies on nasm/gcc plus a small runtime library (libababiu) to produce a native executable.
File structure
• Top-level:
• build scripts: makefile, CMakeLists.txt, xmake.lua
• runtime library: libababiu/
• sources: src/ with one subdirectory per compiler phase or helper
• tests: src/main_test.cc, test.abb
• Phase modules under src/:
• CmdLineParser – handles CLI flags and input/output filenames
• FileManager – reads/writes source and generated files
• Lexer – tokenizes the input text
• Parser – builds AST (including control, loop, function, unit nodes)
• IR – intermediate representation container
• Symbol – symbol table & scope management
• PointerManager, AutoAssign, StackEraser – semantic/optimization passes
• CodeGen – emits raw x86-64 assembly
• SayError – centralized error reporting
• debug – debugging utilities
• env_config – compile‐time configuration
• main.cc – orchestrates whole pipeline
README for additional insights
• It sketches the build and compile flow:
• compile ababiu executable → transform .abb to assembly.asm → assemble + link with libababiu.o → run.
Elements
• Labels: use clear, concise names (“Lexer Module,” “Parser Module,” “CodeGen Module,” etc.)
• External tools/runtime in neutral tones