Skip to content

Instantly share code, notes, and snippets.

@bgogul
Last active October 27, 2022 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgogul/6d5cb4bd10bfd4e529ae3eede0e3501d to your computer and use it in GitHub Desktop.
Save bgogul/6d5cb4bd10bfd4e529ae3eede0e3501d to your computer and use it in GitHub Desktop.
high-level syntax for policy.
// Mapping IR operation to action.
op.action.name
op.action.data
op.action.
op is "egress" on y by blah if {
let operation = op.operator_name in
let x = op.args[0] in
let y = op.args[1] in
operation = "send_data_to_network",
x = "
}
action egress {
// The following properties are always available.
op: Operation,
data: AccessPath,
// Additional properties.
destination: String?,
}
egress contains action_desc if {
some op in Operations,
op.operator = "send_data_to_network",
data = op.args[0],
destination := op.args[1]:constant,
action_desc := {
op: op,
data: data,
destination: destination,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment