Rebrand
This commit is contained in:
parent
3eadd01cfa
commit
bd509560a9
2
Bobfile
2
Bobfile
|
@ -1,4 +1,4 @@
|
||||||
compiler "g++";
|
compiler "g++";
|
||||||
binary "mx";
|
binary "bogus";
|
||||||
source "src/*.cpp";
|
source "src/*.cpp";
|
||||||
compile;
|
compile;
|
||||||
|
|
5
password.bo
Normal file
5
password.bo
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
print "Enter your password: ";
|
||||||
|
let str passwdInput input;
|
||||||
|
if passwdInput == "dingus" {
|
||||||
|
println "Thank you for entering the right password.";
|
||||||
|
}
|
|
@ -14,16 +14,16 @@ ArgParser::ArgParser(int argc, char* argv[]) {
|
||||||
debugMode = true;
|
debugMode = true;
|
||||||
args.erase(args.begin() + i);
|
args.erase(args.begin() + i);
|
||||||
} else if (args[i] == "--help") {
|
} else if (args[i] == "--help") {
|
||||||
cout << "mxlang interpreter" << endl;
|
cout << "Boguslang interpreter" << endl;
|
||||||
cout << "Usage: mx [file]" << endl;
|
cout << "Usage: bogus [file]" << endl;
|
||||||
cout << "Options:" << endl;
|
cout << "Options:" << endl;
|
||||||
cout << " --debug Enable debug mode" << endl;
|
cout << " --debug Enable debug mode" << endl;
|
||||||
cout << " --help Show this help message" << endl;
|
cout << " --help Show this help message" << endl;
|
||||||
cout << "Issues? Send an email to max@maxwellj.xyz" << endl;
|
cout << "Issues? Send an email to max@maxwellj.xyz" << endl;
|
||||||
cout << "Report bugs at https://git.maxwellj.xyz/max/mx" << endl;
|
cout << "Report bugs at https://git.maxwellj.xyz/max/bogus" << endl;
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (args[i] == "--version") {
|
} else if (args[i] == "--version") {
|
||||||
cout << "mxlang, version 0.0.2" << endl;
|
cout << "Boguslang, version 0.0.3" << endl;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Interpreter.h"
|
#include "Interpreter.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
optional<Token> Interpreter::consume() {
|
optional<Token> Interpreter::consume() {
|
||||||
tokenIndex++;
|
tokenIndex++;
|
||||||
|
@ -43,12 +44,26 @@ void Interpreter::convertToTokens(vector<Token> tokenList) {
|
||||||
auto varIt = variables.find(potentialVarName);
|
auto varIt = variables.find(potentialVarName);
|
||||||
|
|
||||||
if (varIt != variables.end()) {
|
if (varIt != variables.end()) {
|
||||||
// Replace the token with the variable's value
|
// This is pretty crappy code but it exists for now. Lists are gonna break this so much it's not even gonna be funny
|
||||||
Token newToken;
|
if (varIt->second.type == valtype::LIST) {
|
||||||
newToken.keyword = keywords::VALUE;
|
if (peek()->keyword == keywords::OSQUA) {
|
||||||
newToken.type = varIt->second.type;
|
if (peek(2)->keyword == keywords::VALUE && peek(2)->type == valtype::INT && peek(2)->type == valtype::INT && peek(3)->keyword == keywords::CSQUA) {
|
||||||
newToken.value = varIt->second;
|
Token newToken;
|
||||||
currentInstruction[i] = newToken;
|
Value tokenVal = get<List>(varIt->second.value).value[get<int>(peek(2)->value.value)];
|
||||||
|
newToken.keyword = keywords::VALUE;
|
||||||
|
newToken.type = tokenVal.type;
|
||||||
|
newToken.value.value = tokenVal.value;
|
||||||
|
// Do this later
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Replace the token with the variable's value
|
||||||
|
Token newToken;
|
||||||
|
newToken.keyword = keywords::VALUE;
|
||||||
|
newToken.type = varIt->second.type;
|
||||||
|
newToken.value = varIt->second;
|
||||||
|
currentInstruction[i] = newToken;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (currentInstruction[i].keyword == keywords::INPUT) {
|
} else if (currentInstruction[i].keyword == keywords::INPUT) {
|
||||||
Token newToken;
|
Token newToken;
|
||||||
|
|
|
@ -131,6 +131,8 @@ void Parser::processLines() {
|
||||||
else if (ct == "<") token.keyword = keywords::LESS;
|
else if (ct == "<") token.keyword = keywords::LESS;
|
||||||
else if (ct == ">") token.keyword = keywords::GREATER;
|
else if (ct == ">") token.keyword = keywords::GREATER;
|
||||||
else if (ct == "//") token.keyword = keywords::COMMENT;
|
else if (ct == "//") token.keyword = keywords::COMMENT;
|
||||||
|
else if (ct == "[") token.keyword = keywords::OSQUA;
|
||||||
|
else if (ct == "]") token.keyword = keywords::CSQUA;
|
||||||
else {
|
else {
|
||||||
token.keyword = keywords::VALUE;
|
token.keyword = keywords::VALUE;
|
||||||
// Convert the value based on its type
|
// Convert the value based on its type
|
||||||
|
|
13
src/common.h
13
src/common.h
|
@ -10,12 +10,12 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
enum class valtype {
|
enum class valtype {
|
||||||
INT, DEC, STR, BOOL, KEYWORD, UNKNOWN
|
INT, DEC, STR, BOOL, LIST, KEYWORD, UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class keywords {
|
enum class keywords {
|
||||||
IF, ELSE, WHILE, INT, DEC, STR, BOOL, FUN, RETURN,
|
IF, ELSE, WHILE, INT, DEC, STR, BOOL, FUN, RETURN,
|
||||||
OPARE, CPARE, OBRAC, CBRAC,
|
OPARE, CPARE, OBRAC, CBRAC, OSQUA, CSQUA, COMMA,
|
||||||
SET, ADDTO, SUBTRACTFROM, MULTIPLYTO, DIVIDEFROM,
|
SET, ADDTO, SUBTRACTFROM, MULTIPLYTO, DIVIDEFROM,
|
||||||
ADD, SUBTRACT, MULTIPLY, DIVIDE,
|
ADD, SUBTRACT, MULTIPLY, DIVIDE,
|
||||||
EQUAL, INEQUAL, LESS, GREATER, EQLESS, EQGREATER,
|
EQUAL, INEQUAL, LESS, GREATER, EQLESS, EQGREATER,
|
||||||
|
@ -25,9 +25,16 @@ enum class keywords {
|
||||||
COMMENT
|
COMMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Value;
|
||||||
|
|
||||||
|
struct List {
|
||||||
|
valtype type;
|
||||||
|
vector<Value> value;
|
||||||
|
};
|
||||||
|
|
||||||
struct Value {
|
struct Value {
|
||||||
valtype type;
|
valtype type;
|
||||||
variant<int, double, string, bool> value;
|
variant<int, double, string, bool, List> value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Token {
|
struct Token {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let str thing2 "dingus";
|
let str thing1 "dingus";
|
||||||
let str thing2 "dingus";
|
let str thing2 "dingus";
|
||||||
|
|
||||||
if thing1 == thing2 {
|
if thing1 == thing2 {
|
Loading…
Reference in New Issue
Block a user