causal-hub 0.0.4

A library for causal models, inference and discovery.
Documentation
WHITESPACE = _{ " " | "\t" | NEWLINE }
NEWLINE = _{ "\r\n" | "\n" }

file = { SOI ~ (network ~ variable* ~ probability*) ~ EOI }

network = { "network" ~ identifier ~ "{" ~ property* ~ "}" }

property = { "property" ~ identifier ~ identifier ~ ";" }

variable = {
    "variable" ~ identifier ~ "{" ~
    "type" ~ "discrete" ~ "[" ~ number ~ "]" ~ "{" ~ identifier_list ~ "}" ~ ";" ~
    property* ~
    "}"
}

probability = {
    "probability" ~ "(" ~ identifier ~ parents? ~ ")" ~ "{" ~
    ( "table" ~ number_list ~ ";" | entry+ ) ~
    property* ~
    "}"
}

parents = { "|" ~ identifier_list }

entry = { "(" ~ identifier_list ~ ")" ~ number_list ~ ";" }

identifier_list = { identifier ~ ("," ~ identifier)* }
number_list = { number ~ ("," ~ number)* }

identifier = @{ quoted_string | unquoted_string }

quoted_string = @{ "\"" ~ (!"\"" ~ ANY)* ~ "\"" }
unquoted_string = @{ (ASCII_ALPHANUMERIC | "_" | "-" | "+" | "=" | "/" | "<" | ">" | ".")+ }

number = @{ "-"? ~ ASCII_DIGIT+ ~ ("." ~ ASCII_DIGIT+)? ~ (("e" | "E") ~ ("+" | "-")? ~ ASCII_DIGIT+)? }