take me to moisty mire but not loot take
This commit is contained in:
parent
2f69d187f2
commit
8d1504a6a7
25
compiler.cpp
25
compiler.cpp
@ -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;
|
||||
}
|
||||
}
|
||||
|
15
readme.md
15
readme.md
@ -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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user