Three Concepts: Probability | Projects and assignments
Here is a grammar for the network descriptions that the data generators should use. The grammar is in Extended BNF. The lexical syntax of string literals and indentifiers is the same as in C and Java. Escape sequences in string literals may be omitted, and a richer language to express real constants may be used (e.g. one accepting 10E-2 etc.) In addition, the parser should be insensitive to white space and C-style comments.
Lexemes:
BROPEN ::= '{'
BRCLOSE ::= '}'
PAOPEN ::= '('
PACLOSE ::= ')'
SEMIC ::= ';'
EQUALS ::= '='
VBAR ::= '|'
DOT ::= '.'
MINUS ::= '-'
NET ::= "net"
NODE ::= "node"
POTENTIAL ::= "potential"
Number ::= '0'|'1'|..|'9'
Integer ::= MINUS? Number+
Real ::= MINUS? Number+ DOT Number+
String ::= /* C/Java String literal */
Identifier ::= /* C/Java identifier */
Productions:
bnetwork ::= net? node* potential*
net ::= NET attributes
node ::= NODE Identifier attributes
potential ::= POTENTIAL potlist attributes
attribute ::= Identifier EQUALS value SEMIC
attributes ::= BROPEN attribute* BRCLOSE
list ::= PAOPEN value* PACLOSE
value ::= Integer | String | Real | list
potlist ::= PAOPEN Identifier PACLOSE
| PAOPEN Identifier VBAR Identifier+ PACLOSE
The nodes should have attributes label and states that give the name of the label and a list of its possible states. The potentials should give the probability tables for the nodes as list attributes labeled data. The generator must silently ignore all attributes unknown to it. Study the networks output by B-Course to get a grip of the format!
| Three Concepts: Probability | |