Create ExprSyntactic.g4

This commit is contained in:
Mandeep Moun
2025-09-25 21:49:56 -06:00
committed by GitHub
parent 65822c9502
commit 184793f0e2

44
ExprSyntactic.g4 Normal file
View File

@@ -0,0 +1,44 @@
parser grammar ExprSyntactic;
options {
tokenVocab=ExprLexer;
}
identifier: IDENTIFIER;
qualifiedIdentifier: identifier {'.' identifier};
literal: IntegerLiteral
| FloatingPointLiteral
| CharacterLiteral
| StringLiteral
| BooleanLiteral
| NullLiteral;
expression: expression1 [assignmentOperator expression1];
assignmentOperator: Assignment
| AddAssign
| SubtractAssign
| MultiplyAssign
| DivideAssign
| BitwiseANDAssign
| BitwiseORAssign
| BitwiseXORAssign
| RemainderAssign
| LeftShiftAssign
| SighnedRightShiftAssign
| UnsighnedRightShiftAssign;
type: identifier {'.' identifier} bracketsOpt
| basicType;
statementExpression: expression;
constantExpression: expression;
expression1: expression2 [expression1Rest];
expression1Rest: ['?' expression ':' expression1];
expression2: expression3 [expression2Rest];