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:
@@ -0,0 +1,20 @@
|
||||
#include <Object/ObjectBase.hpp>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace Fig;
|
||||
|
||||
Value null;
|
||||
Value d = Value::FromDouble(-std::numbers::pi);
|
||||
Value i = Value::FromInt(-2143242);
|
||||
Value b = Value::FromBool(false);
|
||||
|
||||
std::cout << null.ToString() << '\n';
|
||||
std::cout << d.ToString() << '\n';
|
||||
std::cout << i.ToString() << '\n';
|
||||
std::cout << b.ToString() << '\n';
|
||||
}
|
||||
Reference in New Issue
Block a user