_seps: "',.(){}=-<>^&|!-□◇~"

23 sym_block = ["sym(" .w? .._seps!:"sym" , type_or_fun:"arg" .w? ")"]
22 pair = ["(" .w? .s!.(, type_or_fun:"arg") .w? ")"]
21 jud = [type_or_pow:"left" .w? ":":"jud" .w? type_or_fun:"right"]
20 sd = ["sd(":"sd" .w? type_or_fun:"left" , type_or_fun:"right" .w? ")"]
19 or = .s!([.w? "|" .w?] and:"arg")
18 and = .s!([.w? "&" .w?] type_or_pow:"arg")
17 var = [.._seps!:"name" ?"'":"sym"]
16 imply_left = or:"or"
15 , = [.w? "," .w?]
14 app_left = {pair:"pair" sym_block:"un" var:"var"}
13 app = [!"all(" !"excm(" !"sd(" app_left:"left"
    .r?(["(" .w? .s!(, type_or_fun:"arg") .w? ")"])]
12 all = ["all(":"all" .w? type_or_fun:"arg" .w? ")"]
11 type_or_fun = fun:"bin"
10 type_or_pow = {
    pow:"bin"
    typeleft_or_un
}
9 fun = [type:"left" ?[.w? "->":"fun" .w? type_or_fun:"right"]]
8 excm = ["excm(":"excm" .w? type:"arg" .w? ")"]
7 un = [{"!":"not" "□":"nec" "◇":"pos" "~":"qu"} typeleft_or_un:"arg"]
6 bin = [type_or_pow:"left" .w? {
    "==":"eq"
    "=^=":"pow_eq"
    "~~":"q"
    ".":"comp"
} .w? type_or_pow:"right"]
5 pow = [typeleft:"left" .w? "^":"pow" .w? typeleft:"right"]
4 imply = [imply_left:"left" .w? "=>":"imply" .w? type:"right"]
3 typeleft_or_un = {
    un:"un"
    typeleft
}
2 typeleft = {
    excm:"un"
    all:"un"
    sd:"bin"
    "true":"true"
    "false":"false"
    app:"app"
    sym_block:"un"
    var:"var"
}
1 type = {
    imply:"bin"
    bin:"bin"
    jud:"bin"
    or:"or"
}
0 doc = [.w? type_or_fun:"type" .w?]

