Created
May 17, 2019 00:19
-
-
Save westphallm1/1ab52b963f34ef6a62438c3bc74e597a to your computer and use it in GitHub Desktop.
Pest grammar for process calculus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var = {('a'..'z') ~ ('a'..'z'|'A' .. 'Z'| '0' .. '9')*} | |
num = {"-"? ~ ('0'..'9')+} | |
opr = {"+"|"*"|"-"|"/"} | |
chan = {('A'..'Z') ~ ('a'..'z'|'A' .. 'Z'| '0' .. '9')*} | |
expr = {term ~ opr ~ expr | term} | |
term = {var | num | "("~ expr ~")"} | |
bexpr = {"true" | "false" | expr ~ "<" ~ expr} | |
def_list = { def ~ "\n" ~ def_list | def } | |
def = { chan ~ "=" ~ proc_list | proc_list} | |
proc_list = {procs ~ "|" ~proc_list | procs} | |
procs = {proc_ ~ ";" ~ procs | proc_ ~";"?} | |
proc_ = {"done" | var ~ "<-" ~ chan | expr ~ "->" ~ chan | "[" ~ bexpr ~ "]" | | |
chan} | |
WHITESPACE = _{" "} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment