CBMC
statement_list_parser.cpp File Reference

Statement List Language Parser. More...

#include "statement_list_parser.h"
#include <util/std_code.h>
#include <util/string_constant.h>
#include "statement_list_parse_tree.h"
#include "statement_list_parse_tree_io.h"
#include <algorithm>
#include <iostream>
#include <iterator>
+ Include dependency graph for statement_list_parser.cpp:

Go to the source code of this file.

Functions

static irep_idt find_name (const exprt &root)
 Searches for the name of the TIA module inside of its root expression. More...
 
static std::string find_version (const exprt &root)
 Searches for the version of the TIA module inside of its root expression. More...
 
static typet find_return_value (const exprt &root)
 Searches for the return type of a function inside of its root expression. More...
 
static exprt find_variable_list (const exprt &root)
 Searches for the variable list of the TIA module inside of its root expression. More...
 
static void fill_vars_with_default_values (statement_list_parse_treet::var_declarationst &parse_tree_list, const exprt &var_list)
 Adds all variable declarations (which can have a default value) to the given list. More...
 
static void fill_temp_vars (statement_list_parse_treet::var_declarationst &parse_tree_list, const exprt &temp_vars)
 Adds all temp variable declarations (variable declarations which can't have a default value) to the given list. More...
 
static void find_variables (statement_list_parse_treet::functiont &function, const exprt &var_decls)
 Adds all valid variable declarations to the given function. More...
 
static void find_variables (statement_list_parse_treet::function_blockt &block, const exprt &var_decls)
 Adds all valid variable declarations to the given function block. More...
 
static exprt find_network_list (const exprt &root)
 Searches for the network list of the TIA element inside of its root expression. More...
 
static std::string find_network_title (const exprt &network)
 Searches for the title of a network inside of its root expression. More...
 
static exprt find_network_instructions (const exprt &network)
 Searches for the instruction list of a network inside of its root expression. More...
 
static void find_instructions (statement_list_parse_treet::networkt &network, const exprt &instructions)
 Adds all valid instructions to the given network. More...
 
static void find_networks (statement_list_parse_treet::tia_modulet &module, const exprt &network_list)
 Adds all valid networks and their instructions to the given function element. More...
 
int yystatement_listlex_init_extra (statement_list_parsert *, void **)
 
int yystatement_listlex_destroy (void *)
 
int yystatement_listparse (statement_list_parsert &, void *)
 Defined in statement_list_y.tab.cpp. More...
 
void yystatement_listset_debug (int, void *)
 

Detailed Description

Statement List Language Parser.

Definition in file statement_list_parser.cpp.

Function Documentation

◆ fill_temp_vars()

static void fill_temp_vars ( statement_list_parse_treet::var_declarationst parse_tree_list,
const exprt temp_vars 
)
static

Adds all temp variable declarations (variable declarations which can't have a default value) to the given list.

Parameters
parse_tree_listThe list to fill with all declarations.
temp_varsThe root expression of a temp variable list.

Definition at line 141 of file statement_list_parser.cpp.

◆ fill_vars_with_default_values()

static void fill_vars_with_default_values ( statement_list_parse_treet::var_declarationst parse_tree_list,
const exprt var_list 
)
static

Adds all variable declarations (which can have a default value) to the given list.

Parameters
parse_tree_listThe list to fill with all declarations.
var_listThe root expression of a variable list with optional default values.

Definition at line 109 of file statement_list_parser.cpp.

◆ find_instructions()

static void find_instructions ( statement_list_parse_treet::networkt network,
const exprt instructions 
)
static

Adds all valid instructions to the given network.

Parameters
networkThe network to which the instructions belong.
instructionsThe root expression of a valid instruction list.

Definition at line 255 of file statement_list_parser.cpp.

◆ find_name()

static irep_idt find_name ( const exprt root)
static

Searches for the name of the TIA module inside of its root expression.

Parameters
rootExpression that includes the element's name as a direct operand.
Returns
The name of the function element.

Definition at line 31 of file statement_list_parser.cpp.

◆ find_network_instructions()

static exprt find_network_instructions ( const exprt network)
static

Searches for the instruction list of a network inside of its root expression.

Parameters
networkExpression that includes the network's instructions as a direct operand.
Returns
The instruction list expression of the network.

Definition at line 242 of file statement_list_parser.cpp.

◆ find_network_list()

static exprt find_network_list ( const exprt root)
static

Searches for the network list of the TIA element inside of its root expression.

Parameters
rootExpression that includes the element's network list as a direct operand.
Returns
The network list of the element.

Definition at line 213 of file statement_list_parser.cpp.

◆ find_network_title()

static std::string find_network_title ( const exprt network)
static

Searches for the title of a network inside of its root expression.

Parameters
networkExpression that includes the network's title as a direct operand.
Returns
The title of the network.

Definition at line 227 of file statement_list_parser.cpp.

◆ find_networks()

static void find_networks ( statement_list_parse_treet::tia_modulet module,
const exprt network_list 
)
static

Adds all valid networks and their instructions to the given function element.

Parameters
moduleThe TIA element to which the networks belong.
network_listThe root expression of a valid network list.

Definition at line 288 of file statement_list_parser.cpp.

◆ find_return_value()

static typet find_return_value ( const exprt root)
static

Searches for the return type of a function inside of its root expression.

Parameters
rootExpression that includes the function's return type as a direct operand.
Returns
The return type of the function.

Definition at line 74 of file statement_list_parser.cpp.

◆ find_variable_list()

static exprt find_variable_list ( const exprt root)
static

Searches for the variable list of the TIA module inside of its root expression.

Parameters
rootExpression that includes the element's variable list as a direct operand.
Returns
The variable list of the element.

Definition at line 94 of file statement_list_parser.cpp.

◆ find_variables() [1/2]

static void find_variables ( statement_list_parse_treet::function_blockt block,
const exprt var_decls 
)
static

Adds all valid variable declarations to the given function block.

Parameters
blockThe TIA element to which the variables belong.
var_declsThe root expression of a valid variable list.

Definition at line 187 of file statement_list_parser.cpp.

◆ find_variables() [2/2]

static void find_variables ( statement_list_parse_treet::functiont function,
const exprt var_decls 
)
static

Adds all valid variable declarations to the given function.

Parameters
functionThe TIA element to which the variables belong.
var_declsThe root expression of a valid variable list.

Definition at line 165 of file statement_list_parser.cpp.

◆ find_version()

static std::string find_version ( const exprt root)
static

Searches for the version of the TIA module inside of its root expression.

Parameters
rootExpression that includes the element's version as a direct operand.
Returns
The version of the element.

Definition at line 56 of file statement_list_parser.cpp.

◆ yystatement_listlex_destroy()

int yystatement_listlex_destroy ( void *  )

◆ yystatement_listlex_init_extra()

int yystatement_listlex_init_extra ( statement_list_parsert ,
void **   
)

◆ yystatement_listparse()

int yystatement_listparse ( statement_list_parsert ,
void *   
)

Defined in statement_list_y.tab.cpp.

Main function for the parse process generated by bison, performs all necessary steps to fill the parse tree.

◆ yystatement_listset_debug()

void yystatement_listset_debug ( int  ,
void *   
)