Minor cleanup
This commit is contained in:
parent
f00b7c4296
commit
9373c59c44
3 changed files with 4 additions and 8 deletions
|
@ -21,9 +21,7 @@ namespace arookas {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CompileExpression(sunCompiler compiler, sunExpression expression, Stack<sunOperator> operatorStack) {
|
static void CompileExpression(sunCompiler compiler, sunExpression expression, Stack<sunOperator> operatorStack) {
|
||||||
// this implementation assumes that the expression production child list alternates between operand and operator
|
var stackCount = operatorStack.Count;
|
||||||
// we can safely assume this as the grammar "operand {binary_operator operand}" enforces it
|
|
||||||
int stackCount = operatorStack.Count;
|
|
||||||
foreach (var node in expression) {
|
foreach (var node in expression) {
|
||||||
if (node is sunOperand) {
|
if (node is sunOperand) {
|
||||||
var operand = node as sunOperand;
|
var operand = node as sunOperand;
|
||||||
|
|
|
@ -199,10 +199,8 @@ namespace arookas {
|
||||||
mLocalStack.Push(mLocal++);
|
mLocalStack.Push(mLocal++);
|
||||||
}
|
}
|
||||||
public void PopLocal() {
|
public void PopLocal() {
|
||||||
if (mLocalStack.Count > 0) {
|
|
||||||
mLocalStack.Pop();
|
mLocalStack.Pop();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// system symbols
|
// system symbols
|
||||||
void AddSystemSymbols() {
|
void AddSystemSymbols() {
|
||||||
|
|
Loading…
Reference in a new issue