Comments, var access, start on objects

This commit is contained in:
2025-10-26 19:16:35 +11:00
parent c73142178a
commit 191410d174
4 changed files with 30 additions and 15 deletions

View File

@@ -84,18 +84,6 @@ Executor::Executor(ASTCodeBlock in, bool isInitCall, std::map<std::string, ASTVa
std::cout << "Expected value after = sign" << std::endl;
exit(1);
}
} else if (id == "==") {
} else if (id == "!=") {
} else if (id == ">") {
} else if (id == ">=") {
} else if (id == "<") {
} else if (id == "<=") {
}
} else {
std::cout << "Expected function or operator after identifier" << std::endl;
@@ -112,7 +100,12 @@ Executor::Executor(ASTCodeBlock in, bool isInitCall, std::map<std::string, ASTVa
for (auto &callArgNode : callArgNodes) {
if (std::holds_alternative<std::shared_ptr<ASTValue>>(callArgNode)) {
callArgs.push_back(*std::get<std::shared_ptr<ASTValue>>(callArgNode));
} else if (std::holds_alternative<std::shared_ptr<ASTIdentifier>>(callArgNode)) {
if (variables.find(std::get<std::shared_ptr<ASTIdentifier>>(callArgNode)->name) != variables.end()) {
callArgs.push_back(variables[std::get<std::shared_ptr<ASTIdentifier>>(callArgNode)->name]);
}
}
}
if (fnName == "import") {
// work on importing modules later

View File

@@ -13,6 +13,12 @@
* context of execution. The class implements mechanisms for traversing AST nodes
* and consuming or peeking at individual nodes.
*/
class Object {
public:
std::vector<Object> children;
};
class Executor {
private:
std::map<std::string, ASTFunction> functions;