I worked with the Boost mini compiler example. Here is the root of the source code: http://www.boost.org/doc/libs/1_59_0/libs/spirit/example/qi/compiler_tutorial/mini_c/
The fragment that interests me is in statement_def.hpp
The problem I am facing is that if you attach semantic actions, such as
statement_ =
variable_declaration[print_this_declaration]
| assignment
| compound_statement
| if_statement
| while_statement
| return_statement
;
And then run the compiler mini_cin an example program, for example:
int foo(n) {
if (n == 3) { }
return a;
}
int main() {
return foo(10);
}
It launches the "Duplicate Function Error" found in the file "compile.cpp" (found using the link above). Here is a snippet for quick reference:
if (functions.find(x.function_name.name) != functions.end())
{
error_handler(x.function_name.id, "Duplicate function: " + x.function_name.name);
return false;
}
In life, I can’t understand why.
, , , - , , ( ).
, - , - ( ).
, , , ( Boost, ), - //Iterator , t ( SA), - .