#include <dve_parser.hh>
Public Types | |
enum | parser_mode_t { SYSTEM, PROCESS, PROB_TRANSITION, TRANSITION, EXPRESSION } |
Modes of parsing. More... | |
Public Member Functions | |
void | check_restrictions_put_on_property () |
dve_parser_t (error_vector_t &evect, dve_expression_t *my_expression) | |
A constructor for creating of a parser of DVE expression. | |
dve_parser_t (error_vector_t &evect, dve_prob_transition_t *my_transition) | |
A constructor for creating of a parser of DVE transition. | |
dve_parser_t (error_vector_t &evect, dve_transition_t *my_transition) | |
A constructor for creating of a parser of DVE transition. | |
dve_parser_t (error_vector_t &evect, dve_prob_process_t *my_process) | |
A constructor for creating of a parser of probabilistic DVE process. | |
dve_parser_t (error_vector_t &evect, dve_process_t *my_process) | |
A constructor for creating of a parser of DVE process. | |
dve_parser_t (error_vector_t &evect, dve_system_t *my_system) | |
A constructor for creating of a parser of entire DVE source file. | |
size_int_t | get_current_process () const |
Returns the context for parsing of expression or transition. | |
dve_expression_t * | get_dve_expression_to_fill () |
Returns a expression, which is filled in by the parser. | |
dve_prob_transition_t * | get_dve_prob_transition_to_fill () |
Returns a probabilistic transition, which is filled in by the parser. | |
dve_process_t * | get_dve_process_to_fill () |
Returns a process, which is filled in by the parser. | |
dve_system_t * | get_dve_system_to_fill () |
Returns a system, which is filled in by the parser. | |
dve_transition_t * | get_dve_transition_to_fill () |
Returns a transition, which is filled in by the parser. | |
dve_expression_t * | get_expression () const |
Returns the last parsed expression. | |
parser_mode_t | get_mode () |
Returns a mode of parsing. | |
bool | get_probabilistic () |
Returns, whether parsed system can be probabilistic. | |
void | set_current_process (size_int_t process_gid) |
Sets the context for parsing of expression or transition. | |
void | set_dve_expression_to_fill (dve_expression_t *const expr) |
Sets a expression, which should be filled in a parser. | |
void | set_dve_prob_transition_to_fill (dve_prob_transition_t *const trans) |
Sets a probabilistic transition, which should be filled in a parser. | |
void | set_dve_process_to_fill (dve_process_t *const proc) |
Sets a process, which should be filled in a parser. | |
void | set_dve_system_to_fill (dve_system_t *const sys) |
Sets a system, which should be filled in a parser. | |
void | set_dve_transition_to_fill (dve_transition_t *const trans) |
Sets a transition, which should be filled in a parser. | |
void | set_mode (const parser_mode_t new_mode) |
Sets a mode of parsing. | |
void | set_probabilistic (const bool can_be_prob) |
Sets, whether parsed system can be probabilistic. | |
~dve_parser_t () | |
A destructor. | |
Parsing-time methods | |
These methods are called by a Yacc/Bison generated parser and they are determined to store the informations from the syntax analysis.
These functions should not be interesting for a usual developer. | |
void | accept_genbuchi_muller_set_complete () |
void | accept_rabin_streett_first_complete () |
void | accept_rabin_streett_pair_complete () |
void | accept_type (int type) |
void | assertion_create (const char *state_name) |
Called by Bison parser after parsing of assertion definition. | |
void | channel_decl (const char *name) |
Called by Bison parser, when declaration of channel is parsed. | |
void | done () |
Method called by Bison parser after finished parsing. | |
void | expr_array_mem (const char *name, int expr_op=T_SQUARE_BRACKETS) |
void | expr_assign (const int assignType) |
void | expr_bin (const int binaryType) |
void | expr_false () |
void | expr_id (const char *name, int expr_op=T_ID) |
void | expr_nat (const int num) |
void | expr_parenthesis () |
void | expr_state_of_process (const char *proc_name, const char *name) |
void | expr_true () |
void | expr_unary (const int unaryType) |
void | expr_var_of_process (const char *proc_name, const char *name, const bool array=false) |
void | expression_list_store () |
Called by Bison parser, when the item of the list of expressions is parsed. | |
int | get_fcol () |
Returns the first column of the current position of Bison parser. | |
int | get_fline () |
Returns the first line of the current position of Bison parser. | |
int | get_lcol () |
Returns the column line of the current position of Bison parser. | |
int | get_lline () |
Returns the last line of the current position of Bison parser. | |
void | prob_trans_create (const char *name) |
Called by Bison parser, when probabilistic transition is detected. | |
void | prob_transition_part (const char *name, const int weight) |
Called by Bison parser, when a part of probabilistic transition is read. | |
void | proc_decl_begin (const char *name) |
Called by Bison parser, when it observes the begin of process. | |
void | proc_decl_done () |
Called by Bison parser, when it observes the end of process. | |
void | set_fpos (int line, int col) |
void | set_lpos (int line, int col) |
void | state_accept (const char *name) |
void | state_commit (const char *name) |
Called by Bison parser, when declaration of commited state is parsed. | |
void | state_decl (const char *name) |
Called by Bison parser, when declaration of state is parsed. | |
void | state_genbuchi_muller_accept (const char *name) |
void | state_init (const char *name) |
Called by Bison parser, when declaration of initial state is parsed. | |
void | state_list_done () |
void | state_rabin_streett_accept (const char *name) |
void | system_property (const char *name) |
Called by Bison parser, when a name of the property process is parsed. | |
void | system_synchronicity (const int sync, const bool prop=false) |
Called by Bison parser, when synchronicity of a system is parsed. | |
void | take_expression () |
Called by Bison parser, when parsing of expression is expected. | |
void | take_expression_cancel () |
Called by Bison parser in case of error during parsing of expression. | |
void | trans_create (const char *name1, const char *name2, const bool has_guard, const int sync, const int effect_count) |
Called by Bison parser after parsing of transition. | |
void | trans_effect_list_begin () |
Called by Bison parser after keyword "effect" is parsed. | |
void | trans_effect_list_cancel () |
Called by Bison parser, when error occurs during parsing of effects. | |
void | trans_effect_list_end () |
Called by Bison parser after all effects are parsed. | |
void | trans_effect_part () |
Called by Bison parser, when single effect is parsed. | |
void | trans_guard_expr () |
Called by Bison parser, when guard in a transition is parsed. | |
void | trans_sync (const char *name, const int sync, const bool sync_val) |
Called by Bison parser, when synchronization in a transition is parsed. | |
void | type_is_const (const bool const_prefix) |
void | type_list_add (const int type_nbr) |
Called by Bison parser, when the item of the list of types is parsed. | |
void | type_list_clear () |
void | typed_channel_decl (const char *name, const int buffer_size) |
Called by Bison parser, when declaration of typed channed is parsed. | |
void | var_decl_array_size (const int bound) |
void | var_decl_begin (const int type_nbr) |
Called by Bison parser, when variable declaration begins. | |
void | var_decl_cancel () |
void | var_decl_create (const char *name, const int arrayDimesions, const bool initialized) |
void | var_decl_done () |
Called by Bison parser after finished parsing of declaration of variable. | |
void | var_init_field_part () |
void | var_init_is_field (const bool is_field) |
Called by Bison parser, during parsing of initial value of variable. |
It is used by reading methods of dve_system_t, dve_process_t, dve_transition_t and dve_expression_t
enum parser_mode_t |
Modes of parsing.
Used in methods get_mode(), set_mode(). Mode of parsing is automatically set by used constructor od dve_parser_t
void accept_genbuchi_muller_set_complete | ( | ) |
Called by Bison parser, when the declaration of an accepting set in GenBuchi or Muller accepting condition is complete
void accept_rabin_streett_first_complete | ( | ) |
Called by Bison parser, when the declaration of first part of the accepting pair in Rabin or Street accepting condition is complete
void accept_rabin_streett_pair_complete | ( | ) |
Called by Bison parser, when the declaration of an accepting pair in Rabin or Street accepting condition is complete
void accept_type | ( | int | type | ) |
Called by Bison parser, when property type is clear (ie complete accepting condition parsed)
References dve_process_t::set_acceptance(), and dve_process_t::set_acceptance_type_and_groups().
void check_restrictions_put_on_property | ( | ) |
Takes a property process currently set in a filled system and checks, whether all restrictions are fulfilled. If not, it throws errors.
References dve_symbol_table_t::get_channel(), dve_transition_t::get_channel_gid(), dve_transition_t::get_effect(), dve_transition_t::get_effect_count(), dve_expression_t::get_ident_gid(), dve_symbol_t::get_process_gid(), dve_system_t::get_property_process(), dve_source_position_t::get_source_first_col(), dve_source_position_t::get_source_first_line(), dve_source_position_t::get_source_last_col(), dve_source_position_t::get_source_last_line(), dve_transition_t::get_sync_expr_list_size(), dve_transition_t::get_sync_mode(), process_t::get_trans_count(), process_t::get_transition(), dve_symbol_table_t::get_variable(), dve_expression_t::left(), SYNC_EXCLAIM, and SYNC_NO_SYNC.
Referenced by system_property().
void expr_array_mem | ( | const char * | name, | |
int | expr_op = T_SQUARE_BRACKETS | |||
) |
Called by Bison parser, when token representing an identifier of array is read during parsing of an expression
References dve_symbol_table_t::find_global_symbol(), dve_symbol_table_t::find_visible_symbol(), dve_symbol_table_t::get_symbol(), dve_symbol_t::is_variable(), and dve_symbol_t::is_vector().
Referenced by expr_var_of_process().
void expr_assign | ( | const int | assignType | ) |
Called by Bison parser, when assignment is read during parsing of an expression
Assignment is usually not allowed in the syntax of expressions, but this method is only called in effect of transition.
References dve_expression_t::get_ident_gid(), dve_symbol_t::get_lid(), dve_symbol_t::get_name(), dve_expression_t::get_operator(), dve_symbol_t::get_process_gid(), dve_symbol_table_t::get_symbol(), dve_symbol_table_t::get_variable(), dve_symbol_t::is_const(), and dve_symbol_t::is_variable().
void expr_bin | ( | const int | binaryType | ) |
Called by Bison parser, when binary operator is read during parsing of an expression
void expr_false | ( | ) |
Called by Bison parser, when token "true" is read during parsing of an expression
void expr_id | ( | const char * | name, | |
int | expr_op = T_ID | |||
) |
Called by Bison parser, when token representing an identifier of variable is read during parsing of an expression
Variable must not be an array - arrays are covered by method expr_array_mem()
References dve_symbol_table_t::find_global_symbol(), dve_symbol_table_t::find_visible_symbol(), dve_symbol_table_t::get_symbol(), and dve_symbol_t::is_variable().
Referenced by expr_var_of_process().
void expr_nat | ( | const int | num | ) |
Called by Bison parser, when token representing a natural number is read during parsing of an expression
void expr_parenthesis | ( | ) |
Called by Bison parser, when parethesis are read during parsing of an expression
At the time of calling of this method everything inside them is already parsed.
void expr_state_of_process | ( | const char * | proc_name, | |
const char * | name | |||
) |
Called by Bison parser, when a test on a state of a process has been read during parsing of an expression
References dve_symbol_table_t::find_global_symbol(), dve_symbol_table_t::find_symbol(), dve_symbol_t::get_gid(), dve_symbol_t::get_name(), dve_symbol_table_t::get_symbol(), dve_symbol_t::get_symbol_type(), dve_symbol_t::get_valid(), and SYSTEM.
void expr_true | ( | ) |
Called by Bison parser, when token "false" is read during parsing of an expression
void expr_unary | ( | const int | unaryType | ) |
Called by Bison parser, when unary operator is read during parsing of an expression
void expr_var_of_process | ( | const char * | proc_name, | |
const char * | name, | |||
const bool | array = false | |||
) |
Called by Bison parser, when a value of a foreign variable has been read during parsing
References expr_array_mem(), expr_id(), dve_symbol_table_t::find_global_symbol(), dve_symbol_t::get_gid(), dve_symbol_table_t::get_symbol(), and dve_symbol_t::get_valid().
dve_expression_t * get_expression | ( | ) | const |
Returns the last parsed expression.
Causes an exception, when there is not exacly one expression stored in a stack of parsed expressions
parser_mode_t get_mode | ( | ) | [inline] |
Returns a mode of parsing.
Parser is able to parse a system (in DVE format), process, transition or expression according to the pointer given in a constructor
void set_fpos | ( | int | line, | |
int | col | |||
) |
Called by Bison parser in case of reporting of the beginning of the current position to this class
void set_lpos | ( | int | line, | |
int | col | |||
) |
Called by Bison parser in case of reporting of the end of the current position to this class
void state_accept | ( | const char * | name | ) |
Called by Bison parser, when the declaration of accepting state in Buchi accepting condition is done
References dve_symbol_table_t::find_symbol(), dve_symbol_t::get_lid(), and dve_symbol_table_t::get_symbol().
Referenced by state_genbuchi_muller_accept(), and state_rabin_streett_accept().
void state_genbuchi_muller_accept | ( | const char * | name | ) |
Called by Bison parser, when the declaration of accepting state in GenBuchi or Muller accepting set is done
References state_accept().
void state_list_done | ( | ) |
Called by Bison parser, when declarations of all states of current process are parsed
void state_rabin_streett_accept | ( | const char * | name | ) |
Called by Bison parser, when the declaration of accepting state in Rabin or Streett accepting set is done
References state_accept().
void trans_effect_part | ( | ) |
Called by Bison parser, when single effect is parsed.
Last expression (containing effect's assignment) is then taken as an effect of the current transition
void type_is_const | ( | const bool | const_prefix | ) | [inline] |
Called by Bison parser, when it observes, that newly declared variable is constant
void type_list_clear | ( | ) |
Called by Bison parser, when the item of the list of types is already copied somewhere and thus it can be cleared
void var_decl_array_size | ( | const int | bound | ) |
Called by Bison parser, when number representing a bound of array is parsed.
References DVE_MAX_ARRAY_SIZE.
void var_decl_begin | ( | const int | type_nbr | ) |
Called by Bison parser, when variable declaration begins.
Bison parser tells to this class the type of curretly declared variable in parameter type_nbr
void var_decl_cancel | ( | ) |
Called by Bison parser, when error occures during parsing of declaration of variable
void var_decl_create | ( | const char * | name, | |
const int | arrayDimesions, | |||
const bool | initialized | |||
) |
Called by Bison parser after parsing of identifier and initial values
Creates a symbol in Symbol table
References take_expression_cancel().
void var_decl_done | ( | ) |
Called by Bison parser after finished parsing of declaration of variable.
Currently empty method - variable is really created in var_decl_create()
void var_init_field_part | ( | ) |
Called by Bison parser, while it finishes a parsing of expression initialization
Stores last parsed expression to the vector of initial values
void var_init_is_field | ( | const bool | is_field | ) |
Called by Bison parser, during parsing of initial value of variable.
Parser reports, whether initial value is an array of scalar value