@@ -12,28 +12,22 @@ Very, very alpha:
|
|||||||
As an example of what can be parsed and evaluated, here is a fairly complex P4 program from our unit tests:
|
As an example of what can be parsed and evaluated, here is a fairly complex P4 program from our unit tests:
|
||||||
|
|
||||||
```P4
|
```P4
|
||||||
|
struct Testing {
|
||||||
|
bool yesno;
|
||||||
|
int count;
|
||||||
|
};
|
||||||
parser main_parser() {
|
parser main_parser() {
|
||||||
state start {
|
state start {
|
||||||
bool where_to = ts.yesno;
|
Testing ts;
|
||||||
string where_from = "here";
|
ts.count = 1;
|
||||||
string where_where = "here";
|
transition select (ts.count) {
|
||||||
if (where_to) {
|
0: accept;
|
||||||
bool where_from = true;
|
_: reject;
|
||||||
if (where_from) {
|
};
|
||||||
where_to = false;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
where_from = "there";
|
|
||||||
transition select (where_to) {
|
|
||||||
false: reject;
|
|
||||||
true: accept;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
(assuming hat `ts` is an instance of a `struct` with the boolean-typed field `yesno`)
|
|
||||||
|
|
||||||
Please check back often!
|
Please check back often!
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|||||||
Reference in New Issue
Block a user