Seprate syntactic grammar started

This commit is contained in:
Mandeep Moun
2025-09-25 23:06:20 -06:00
parent 184793f0e2
commit 107c519f02
6 changed files with 132 additions and 8 deletions

44
gen/syntactic.g4 Normal file
View File

@@ -0,0 +1,44 @@
parser grammar syntactic;
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];