![]() |
User Guide
|
Visitor to check some semantic rules on the AST More...
Visitor to check some semantic rules on the AST
Current checks:
USEION
statement are not declared in CONSTANT
block.Definition at line 44 of file semantic_analysis_visitor.hpp.
#include <semantic_analysis_visitor.hpp>
Private Member Functions | |
void | visit_program (const ast::Program &node) override |
Check number of DERIVATIVE blocks. More... | |
void | visit_procedure_block (const ast::ProcedureBlock &node) override |
Store if we are in a procedure and if the arity of this is 1. More... | |
void | visit_function_block (const ast::FunctionBlock &node) override |
Store if we are in a function and if the arity of this is 1. More... | |
void | visit_table_statement (const ast::TableStatement &node) override |
Visit a table statement and check that the arity of the block were 1. More... | |
void | visit_destructor_block (const ast::DestructorBlock &node) override |
Visit destructor and check that the file is of type POINT_PROCESS or ARTIFICIAL_CELL. More... | |
void | visit_independent_block (const ast::IndependentBlock &node) override |
Visit independent block and check if one of the variable is not t. More... | |
void | visit_function_table_block (const ast::FunctionTableBlock &node) override |
Visit function table to check that number of args > 0. More... | |
void | visit_protect_statement (const ast::ProtectStatement &node) override |
Look if protect is inside a locked block. More... | |
void | visit_mutex_lock (const ast::MutexLock &node) override |
Look if MUTEXLOCK is inside a locked block. More... | |
void | visit_mutex_unlock (const ast::MutexUnlock &node) override |
Look if MUTEXUNLOCK is outside a locked block. More... | |
void | visit_name (const ast::Name &node) override |
Only use of random_var is as first arg in random function. More... | |
void | visit_function_call (const ast::FunctionCall &node) override |
random function first arg must be random_var More... | |
bool | check_name_conflict (const ast::Program &node) |
bool | check_table_vars (const ast::Program &node) |
Private Attributes | |
bool | check_fail = false |
symtab::SymbolTable * | program_symtab = nullptr |
bool | accel_backend = false |
true if accelerator backend is used for code generation More... | |
bool | one_arg_in_procedure_function = false |
true if the procedure or the function contains only one argument More... | |
bool | in_procedure = false |
true if we are in a procedure block More... | |
bool | in_function = false |
true if we are in a function block More... | |
bool | is_point_process = false |
true if the mod file is of type point process More... | |
bool | in_mutex = false |
true if we are inside a mutex locked part More... | |
|
inline |
Definition at line 103 of file semantic_analysis_visitor.hpp.
bool nmodl::visitor::SemanticAnalysisVisitor::check | ( | const ast::Program & | node | ) |
<– This code is for check 2
-->
<– This code is for check 4
make sure ion variables aren't redefined in a CONSTANT
block.
-->
Definition at line 80 of file semantic_analysis_visitor.cpp.
|
private |
Definition at line 56 of file semantic_analysis_visitor.cpp.
|
private |
Definition at line 29 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Visit destructor and check that the file is of type POINT_PROCESS or ARTIFICIAL_CELL.
<– This code is for check 2
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 268 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Store if we are in a function and if the arity of this is 1.
<– This code is for check 1
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 141 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
random function first arg must be random_var
<– This code is a portion of check 9
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 205 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Visit function table to check that number of args > 0.
<– This code is for check 7
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 292 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Visit independent block and check if one of the variable is not t.
<– This code is for check 5
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 279 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Look if MUTEXLOCK is inside a locked block.
<– This code is for check 6
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 314 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Look if MUTEXUNLOCK is outside a locked block.
<– This code is for check 6
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 326 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Only use of random_var is as first arg in random function.
<– This code is a portion of check 9
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 150 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Store if we are in a procedure and if the arity of this is 1.
<– This code is for check 1
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 132 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Check number of DERIVATIVE blocks.
<– This code is for check 8
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 121 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Look if protect is inside a locked block.
<– This code is for check 6
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 303 of file semantic_analysis_visitor.cpp.
|
overrideprivatevirtual |
Visit a table statement and check that the arity of the block were 1.
<– This code is for check 1
--> <– This code is for check 3
-->
Implements nmodl::visitor::ConstVisitor.
Definition at line 245 of file semantic_analysis_visitor.cpp.
|
private |
true if accelerator backend is used for code generation
Definition at line 51 of file semantic_analysis_visitor.hpp.
|
private |
Definition at line 47 of file semantic_analysis_visitor.hpp.
|
private |
true if we are in a function block
Definition at line 57 of file semantic_analysis_visitor.hpp.
|
private |
true if we are inside a mutex locked part
Definition at line 61 of file semantic_analysis_visitor.hpp.
|
private |
true if we are in a procedure block
Definition at line 55 of file semantic_analysis_visitor.hpp.
|
private |
true if the mod file is of type point process
Definition at line 59 of file semantic_analysis_visitor.hpp.
|
private |
true if the procedure or the function contains only one argument
Definition at line 53 of file semantic_analysis_visitor.hpp.
|
private |
Definition at line 49 of file semantic_analysis_visitor.hpp.