diff options
author | David Walter Seikel | 2012-01-05 09:08:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-05 09:08:13 +1000 |
commit | 2784a07764c90dfda0b84ea2014a7cc030793ef0 (patch) | |
tree | 627186acf339bb0649d09879b6801810bfb5314c | |
parent | Clean up the parser. (diff) | |
download | SledjHamr-2784a07764c90dfda0b84ea2014a7cc030793ef0.zip SledjHamr-2784a07764c90dfda0b84ea2014a7cc030793ef0.tar.gz SledjHamr-2784a07764c90dfda0b84ea2014a7cc030793ef0.tar.bz2 SledjHamr-2784a07764c90dfda0b84ea2014a7cc030793ef0.tar.xz |
Bit more cleanup.
-rw-r--r-- | LuaSL/src/LuaSL_parser.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_parser.c b/LuaSL/src/LuaSL_parser.c index c6026e2..f5a56d3 100644 --- a/LuaSL/src/LuaSL_parser.c +++ b/LuaSL/src/LuaSL_parser.c | |||
@@ -4,14 +4,16 @@ | |||
4 | 4 | ||
5 | int main(void) | 5 | int main(void) |
6 | { | 6 | { |
7 | char test[]=" 4 + 2*10 + 3*( 5 + 1 )"; | 7 | const char test[] = " 4 + 2*10 + 3*( 5 + 1 )"; |
8 | SExpression *e = NULL; | 8 | SExpression *e = NULL; |
9 | int result = 0; | ||
10 | 9 | ||
11 | e = getAST(test); | 10 | if ((e = getAST(test))) |
12 | result = evaluate(e); | 11 | { |
13 | printf("Result of '%s' is %d\n", test, result); | 12 | int result = evaluate(e); |
14 | deleteExpression(e); | 13 | |
14 | printf("Result of '%s' is %d\n", test, result); | ||
15 | deleteExpression(e); | ||
16 | } | ||
15 | 17 | ||
16 | return 0; | 18 | return 0; |
17 | } | 19 | } |