How deviant-liang/deviant works
Project type and purpose
• This is a compiler front-end for a simple educational language (“Deviant”) that parses source code and emits LLVM IR.
• It reads .dv test files or user input, lexes and parses them into an AST, then uses LLVM APIs to generate out.ll.
File structure
• Top-level files:
• CMakeLists.txt – build configuration
• main.cpp – orchestration of the compile pipeline
• out.ll – generated LLVM IR
• test.dv – sample Deviant source file
• / – public interfaces for each phase:
• lexer.h / token.h
• parser.h / ast.h
• user_input.h
• deviant_llvm.h (LLVM codegen)
• src/ – implementation of each interface:
• lexer.cpp
• parser.cpp
• ast.cpp
• user_input.cpp
• deviant_llvm.cpp
README for additional insights
• Use cases: compile simple Deviant programs to LLVM IR for educational purposes.