POMDP File Grammar

Grammar of a POMDP file for pomdp-solve

About this Page

This page gives the formal syntax for the POMDP file format which is used for the 'pomdp-solve' program. The informal, semantic description is on the POMDP File Format Page.

BNF-ish POMDP File Grammar

This is taken from the syntax for the Java version POMDP parser (JavaCup) which was made to match identically to the C parser version (yacc/bison).

pomdp_file    ::= preamble start_state param_list
;

preamble        ::= preamble param_type 
                | /* empty */
;

param_type      ::= discount_param
                | value_param
                | state_param
                | action_param
                | obs_param
;

discount_param  ::= DISCOUNTTOK COLONTOK number
;

value_param    ::= VALUESTOK COLONTOK value_tail
;

value_tail     ::= REWARDTOK
               | COSTTOK
;

state_param    ::= STATESTOK COLONTOK state_tail
;

state_tail     ::= INTTOK
               | ident_list
;

action_param   ::= ACTIONSTOK COLONTOK action_tail
;

action_tail    ::= INTTOK
               | ident_list
;

obs_param ::= OBSERVATIONSTOK COLONTOK obs_param_tail
;

obs_param_tail ::= INTTOK
               | ident_list
;

start_state     ::=  STARTTOK COLONTOK u_matrix
                | STARTTOK COLONTOK STRINGTOK
                | STARTTOK INCLUDETOK COLONTOK start_state_list
                | STARTTOK EXCLUDETOK COLONTOK start_state_list
                |  /* empty */
;

start_state_list    ::= start_state_list state
                    | state
;

param_list     ::= param_list param_spec
               | /* empty */
;

param_spec     ::= trans_prob_spec
               | obs_prob_spec 
               | reward_spec
;

trans_prob_spec     ::= TTOK COLONTOK trans_spec_tail
;

trans_spec_tail     ::= paction COLONTOK state COLONTOK state prob
                    | paction COLONTOK state u_matrix 
                    |  paction ui_matrix
;

obs_prob_spec  ::= OTOK COLONTOK obs_spec_tail
;

obs_spec_tail  ::= paction COLONTOK state COLONTOK obs prob
               | paction COLONTOK state u_matrix
               | paction u_matrix
;

reward_spec    ::= RTOK COLONTOK  reward_spec_tail
;

reward_spec_tail ::= paction COLONTOK state COLONTOK state COLONTOK obs number 
                 | paction COLONTOK state COLONTOK state num_matrix
                 | paction COLONTOK state num_matrix
;

ui_matrix      ::= UNIFORMTOK 
               | IDENTITYTOK 
               | prob_matrix
;

u_matrix  ::= UNIFORMTOK 
          | RESETTOK
          | prob_matrix
;

prob_matrix    ::= prob_matrix prob
               | prob
;

num_matrix     ::= num_matrix number
               | number
;

state          ::= INTTOK
               | STRINGTOK
               | ASTERICKTOK
;

paction         ::= INTTOK
                | STRINGTOK
                | ASTERICKTOK
;

obs       ::= INTTOK
          | STRINGTOK
          | ASTERICKTOK
;

ident_list     ::= ident_list STRINGTOK
               | STRINGTOK
;

prob      ::= INTTOK
          | FLOATTOK
;

number          ::= optional_sign INTTOK
                | optional_sign FLOATTOK
;

optional_sign  ::= PLUSTOK
               | MINUSTOK
               |  /* empty */
;

Terminal Tokens

The terminal tokens defined in the scanner and referenced in the grammar above are:

  DISCOUNTTOK = "discount"
  VALUESTOK = "values"
  STATESTOK = "states"
  ACTIONSTOK = "actions"
  OBSERVATIONSTOK = "observations"
  TTOK = "T"
  OTOK = "O"
  RTOK = "R"
  UNIFORMTOK = "uniform"
  IDENTITYTOK = "identity"
  REWARDTOK = "reward"
  COSTTOK = "cost"
  STARTTOK = "start"
  INCLUDETOK = "include"
  EXCLUDETOK = "exclude"
  RESETTOK = "reset"
  COLONTOK = ":"
  ASTERICKTOK = "*"
  PLUSTOK = "+"
  MINUSTOK = "-"
  INTTOK = 0 | [1-9][0-9]*'
  FLOATTOK = ([0-9]+ \. [0-9]* | \. [0-9]+ | [0-9]+ ) ([eE] [+-]? [0-9]+)?
  STRINGTOK = [a-zA-Z] ( [a-zA-Z0-9] | [\_\-] )*