summaryrefslogtreecommitdiff
path: root/Compiler/CGrammar.g4
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-09 12:51:08 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-09 12:51:08 +1000
commit78d73c6e3a6e96b750bc4100f754484890ea650b (patch)
tree5c6f8b891513534f4fe722202fcbd3f075536c6e /Compiler/CGrammar.g4
parent7f334796e8d0619dc744b1345a7b7b73a27220f9 (diff)
added lazy function definition
Diffstat (limited to 'Compiler/CGrammar.g4')
-rw-r--r--Compiler/CGrammar.g44
1 files changed, 3 insertions, 1 deletions
diff --git a/Compiler/CGrammar.g4 b/Compiler/CGrammar.g4
index b0f145f..1b47978 100644
--- a/Compiler/CGrammar.g4
+++ b/Compiler/CGrammar.g4
@@ -44,7 +44,7 @@ statement
declaration
- : 'int' name=ID ('=' value=expression)? ';' #variableDeclaration
+ : 'int' ptr='*' name=ID ('=' value=expression)? ';' #variableDeclaration
;
expression
@@ -52,6 +52,8 @@ expression
// | left=expression ',' right=expression #commaExpression
| constant #constantExpression
| target '=' expression #assignmentExpression
+ | '*' expression #dereferenceExpression
+ | '&' target #addressOfExpression
| ID #variableExpression
| ID '(' ( params+=expression (',' params+=expression )* )? ')' #callExpression