diff options
author | Carlos Maniero <carlos@maniero.me> | 2023-05-09 16:18:18 -0300 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2023-05-09 22:54:46 +0200 |
commit | ad54ee1182b1549880eddc8b1969d3992d9f7f1d (patch) | |
tree | 34d6a33a6a5ccba3ff6198d0e49f1e1d4701fc27 /examples | |
parent | 8c8fc8cc30b38ef00d606a4991b655df97a52fb6 (diff) |
parser: parses an if statement no code generation
This commit parses a if statement following the grammar bellow:
if boolean_expression {
n_epressions;
}
No else neither code generation was implemented.
Signed-off-by: Carlos Maniero <carlos@maniero.me>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/if.pipa | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/if.pipa b/examples/if.pipa new file mode 100644 index 0000000..2c5578d --- /dev/null +++ b/examples/if.pipa @@ -0,0 +1,9 @@ +fn main(): i32 { + let n: i32 = 42; + + if n > 42 { + return 42; + } + + return n; +} |