Author: mesyeti <mesyeti@mesyeti.uk>
add assign
basic/source/frontend/c89.c | 4 +++- basic/test.bas | 6 +++++-
diff --git a/basic/source/frontend/c89.c b/basic/source/frontend/c89.c index 1cf6d655b1c753f97e829db8fe88c95d50529ef8..1cc83b5e05127cc86b81e72940325702638838c1 100644 --- a/basic/source/frontend/c89.c +++ b/basic/source/frontend/c89.c @@ -146,7 +146,9 @@ fprintf(out, ";\n"); } static void CompileAssign(AssignNode* node) { - + fprintf(out, "nitron_%s = ", node->variable); + CompileExprNode(node->rValue); + fprintf(out, ";\n"); } static void CompileExtern(ExternNode* node) { diff --git a/basic/test.bas b/basic/test.bas index f8cce0e700c79dff0671a0cf3685cc543aeb28fe..8faa77b73533033e2b7384bb5124e5386ff68552 100644 --- a/basic/test.bas +++ b/basic/test.bas @@ -1,5 +1,9 @@ 'NITRON extern func puts(str as ptr(char)) int +extern func printf(str as ptr(char), val as int) int -puts "Hello, world!" +dim a as int +a = 4 * 16 + +printf "My number is %d\n", a