diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2023-05-01 01:57:22 +0200 |
---|---|---|
committer | Carlos Maniero <carlos@maniero.me> | 2023-05-01 18:24:42 -0300 |
commit | e3d8e031c6f20c68f2227028ee8b3e73cd9b8161 (patch) | |
tree | 52068df5df3fea73eea9e5af311b03771a0f614a /examples/variables.pipa | |
parent | 8c56ddf0b640b8880eb5b97e5ca1b787585c29c0 (diff) |
parser: Implement variable assignment
This commit introduces variable assignment making it possible to
change a variable value. Example:
myvar: i32 = 1;
myvar = 2;
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Co-authored-by: Carlos Maniero <carlos@maniero.me>
Diffstat (limited to 'examples/variables.pipa')
-rw-r--r-- | examples/variables.pipa | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/variables.pipa b/examples/variables.pipa index 25cbd59..0723782 100644 --- a/examples/variables.pipa +++ b/examples/variables.pipa @@ -1,6 +1,8 @@ main(): i32 { - a: i32 = 12; - b: i32 = 32; + a: i32 = 13; + a = a - 1; + b: i32 = 33; + b = 32; c: i32 = 2 * (b + a); d: i32 = (c - 33) + 1; e: i32 = d; |