compiler, language, runtime: Separate Parser Type From Instances
In P4, parsers are considered types. Those parsers are instantiated. The instantiated parsers are values. Previously, gp4 treated a parser type and a parser value as identical. This PR makes that difference clear _and_ sets the stage for the future. TODO: Make the same distinction between control and action types and values. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -257,6 +257,12 @@ public typealias VarValueScope = Scope<P4Value>
|
||||
/// Scopes that resolves variable identifiers to their values.
|
||||
public typealias VarValueScopes = Scopes<P4Value>
|
||||
|
||||
/// A scope that resolves variable identifiers to their values.
|
||||
public typealias StaticVarValueScope = Scope<(P4QualifiedType, P4Value?)>
|
||||
|
||||
/// Scopes that resolves variable identifiers to their values.
|
||||
public typealias StaticVarValueScopes = Scopes<(P4QualifiedType, P4Value?)>
|
||||
|
||||
/// Indicate the control flow result of a particular statement.
|
||||
public enum ControlFlow {
|
||||
case Next
|
||||
|
||||
@@ -52,7 +52,7 @@ public protocol EvaluatableLValueExpression: EvaluatableExpression {
|
||||
func set(
|
||||
to: P4Value, inScopes scopes: VarValueScopes, duringExecution execution: ProgramExecution
|
||||
) -> Result<(VarValueScopes, P4Value)>
|
||||
func check(to: EvaluatableExpression, inScopes scopes: VarTypeScopes) -> Result<()>
|
||||
func check(to: EvaluatableExpression, inScopes scopes: StaticVarValueScopes) -> Result<()>
|
||||
}
|
||||
|
||||
public protocol ProgramExecutionEvaluator {
|
||||
|
||||
Reference in New Issue
Block a user