take me to moisty mire but not loot take

This commit is contained in:
ItzzCode 2022-10-21 02:37:10 -04:00
parent 2f69d187f2
commit 8d1504a6a7
2 changed files with 37 additions and 3 deletions

View File

@ -9,12 +9,13 @@ enum token {
eof, // End of File
external, // C stuff
variable, // Name of a variable
tree, // tree{tree, tree{tree{tree, tree}, tree, tree{tree}}}
integer, // integer ._.
string, // string O_O
};
std::string identifierStr; // filled if string
long NumVal; // filled if integer
long numVal; // filled if integer
int getTok() {
int lastChar = ' ';
@ -28,9 +29,29 @@ int getTok() {
while( isalnum((lastChar = getchar())) )
identifierStr += lastChar;
if( identifierStr == "" )
if( identifierStr == "external" )
return external;
if( isdigit(lastChar) ) {
std::string numStr;
do {
numStr += lastChar;
lastChar = getchar();
} while( isdigit(lastChar) );
numVal = atol(numStr.c_str());
return integer;
}
if( lastChar == '#' ) {
do
lastChar = getchar();
while (lastChar != EOF && lastChar != '\n' && lastChar != '\r');
if (lastChar != EOF)
return getTok();
}
return variable;
}
}

View File

@ -1,3 +1,16 @@
# TreeLang
Treeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
TreeLang is an half esolang thingy with trees
## Examples
```TreeLang
# assigning to treeThing
treeThing <- 93 { # root node
"childNode1", # child node 1: the legacy of the root
1942 { # child node with children
"AAA", # child of child
"AUGH"
}
}
```