Hy guys, i'm developing a scripting engine with flex and bison and now
i'm implementing the eval and load functions for this language.
Just to give you an example, the syntax is like :
import std.*;
load( "some_script.hy" );
eval( "foo = 123;" );
println( foo );
So, in my lexer i've implemented the function :
void hyb_parse_string( const char *str ){
    extern int yyparse(void);
    YY_BUFFER_STATE prev, next;
    /*
     * Save current buffer.
     */
    prev = YY_CURRENT_BUFFER;
    /*
     * yy_scan_string will call yy_switch_to_buffer.
     */
    next = yy_scan_string( str );
    /*
     * Do actual parsing (yyparse calls yylex).
     */
    yyparse();
    /*
     * Restore previous buffer.
     */
    yy_switch_to_buffer(prev);
}
But it does not seem to work.
Well, it does but when the string (loaded from a file or directly
evaluated) is finished, i get a sigsegv :
Program received signal SIGSEGV, Segmentation fault.
0xb7f2b801 in yylex () at src/lexer.cpp:1658
1658            if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
As you may notice, the sigsegv is generated by the flex/bison code,
not mine ... any hints, or at least any example on how to implement those kind of functions?
PS: I've succesfully implemented the include directive, but i need eval and load to work not at parsing time but execution time (kind of PHP's include/require directives).