Module sesstype::parser
[−]
[src]
The module provides parser for a simple session type language.
Grammar
Two parser functions are provided for Global Type and Local Type
respectively, as with the parent sesstype
module, both types share
common elements role
and message
, and the grammars are shown below:
Common
⚠Be careful when using this code, it's not being tested!
ident = [A-Za-z][A-Za-z0-9]* role = ident message = ident payload payload = "()" | "(" ident ")"
Global Types
⚠Be careful when using this code, it's not being tested!
global = "(" role "->" role ":" interact ")" | recur | typevar | end interact = sendrecv | "{" sendrecv ("," sendrecv)+ "}" sendrecv = message "." global recur = "*" ident "." global typevar = ident end = "end"
Local Types
⚠Be careful when using this code, it's not being tested!
local = role branch | role select | lrecur | ltypevar | end branch = recv | "&{" recv ("," recv)+ "}" recv = "?" message "." local select = send | "+{" send ("," send)+ "}" send = "!" message "." local lrecur = "*" ident "." local ltypevar = ident lend = "end"
Structs
RoleRegistry |
Registry of roles in a parsed protocol. |
Functions
parse_global_type |
Returns parsed |
parse_local_type |
Returns parsed |