grammar,compiler: Add Support For Fixed-Width Integers
Continuous Integration / Grammar Tests (push) Successful in 4m13s
Continuous Integration / Library Format Tests (push) Successful in 5m17s
Continuous Integration / Library Tests (push) Failing after 8m34s
Continuous Integration / Cli Tests (push) Failing after 4m40s

Distinguishing between signed and unsigned fixed-width integer
types must still be done.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-18 06:52:21 -04:00
parent cbebcae20a
commit a7d8fd1304
16 changed files with 328 additions and 48 deletions
+66 -5
View File
@@ -46,7 +46,7 @@ parser simple() {
)
=========================
Simple Declaration (int)
Simple Declaration (infinite-precision int)
=========================
parser simple() {
state start {
@@ -73,7 +73,9 @@ parser simple() {
(variableDeclaration
(typeRef
(baseType
(int)
(int_type
(int)
)
)
)
(identifier)
@@ -92,6 +94,59 @@ parser simple() {
)
)
=========================
Simple Declaration (fixed-precision int)
=========================
parser simple() {
state start {
int<55> l;
transition accept;
}
};
---
(p4program
(declaration
(parserDeclaration
(parserType
(parser)
(identifier)
(parameters)
)
(parserStates
(parserState
(state)
(identifier)
(parserStatements
(parserStatement
(variableDeclaration
(typeRef
(baseType
(int_type
(int)
(bit_width
(integer)
)
)
)
)
(identifier)
)
)
)
(parserTransitionStatement
(transition)
(transitionSelectionExpression
(identifier)
)
)
)
)
)
)
)
=========================
Simple Declaration (string)
=========================
@@ -331,7 +386,9 @@ bool functionb(bool a, int b) {
(parameter
(typeRef
(baseType
(int)
(int_type
(int)
)
)
)
(identifier)
@@ -393,7 +450,9 @@ bool functionb(in bool a, out int b, inout string c) {
)
(typeRef
(baseType
(int)
(int_type
(int)
)
)
)
(identifier)
@@ -468,7 +527,9 @@ extern bool functionb(in bool a, out int b, inout string c);
)
(typeRef
(baseType
(int)
(int_type
(int)
)
)
)
(identifier)