feat: Implement compiler and virtual machine for Fig language
- Added Compiler class with methods for compiling programs, statements, and expressions. - Introduced Proto structure to hold compiled bytecode and constants. - Implemented expression compilation including literals, identifiers, and infix expressions. - Developed statement compilation for variable declarations and expression statements. - Created a VM class to execute compiled bytecode with support for arithmetic and comparison operations. - Added Object and Value classes for handling different data types and memory management. - Implemented String and Struct objects for enhanced data representation. - Established a parser for parsing variable declarations and statements. - Included tests for the VM and object representations.
This commit is contained in:
34
xmake.lua
34
xmake.lua
@@ -44,10 +44,34 @@ target("ParserTest")
|
||||
|
||||
add_files("src/Ast/Operator.cpp")
|
||||
add_files("src/Parser/ExprParser.cpp")
|
||||
add_files("src/Parser/StmtParser.cpp")
|
||||
add_files("src/Parser/Parser.cpp")
|
||||
|
||||
add_files("src/Parser/ParserTest.cpp")
|
||||
|
||||
target("ObjectTest")
|
||||
add_files("src/Object/Object.cpp")
|
||||
add_files("src/Object/ObjectTest.cpp")
|
||||
|
||||
target("CompilerTest")
|
||||
add_files("src/Core/*.cpp")
|
||||
add_files("src/Token/Token.cpp")
|
||||
add_files("src/Error/Error.cpp")
|
||||
add_files("src/Lexer/Lexer.cpp")
|
||||
|
||||
add_files("src/Ast/Operator.cpp")
|
||||
add_files("src/Parser/ExprParser.cpp")
|
||||
add_files("src/Parser/StmtParser.cpp")
|
||||
add_files("src/Parser/Parser.cpp")
|
||||
|
||||
add_files("src/Object/Object.cpp")
|
||||
|
||||
add_files("src/Compiler/ExprCompiler.cpp")
|
||||
add_files("src/Compiler/StmtCompiler.cpp")
|
||||
add_files("src/Compiler/Compiler.cpp")
|
||||
|
||||
add_files("src/Compiler/CompileTest.cpp")
|
||||
|
||||
target("Fig")
|
||||
add_files("src/Core/*.cpp")
|
||||
add_files("src/Token/Token.cpp")
|
||||
@@ -56,6 +80,14 @@ target("Fig")
|
||||
|
||||
add_files("src/Ast/Operator.cpp")
|
||||
add_files("src/Parser/ExprParser.cpp")
|
||||
add_files("src/Parser/StmtParser.cpp")
|
||||
add_files("src/Parser/Parser.cpp")
|
||||
|
||||
|
||||
add_files("src/Object/Object.cpp")
|
||||
|
||||
add_files("src/Compiler/ExprCompiler.cpp")
|
||||
add_files("src/Compiler/StmtCompiler.cpp")
|
||||
add_files("src/Compiler/Compiler.cpp")
|
||||
|
||||
add_files("src/VM/VM.cpp")
|
||||
add_files("src/main.cpp")
|
||||
Reference in New Issue
Block a user