grammar,compiler: Add Support For Fixed-Width Integers
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user