I want to write a parser that provides API like const char *convertA2B(const char *input)
. It looks like:
- lex_and_yacc(input) -> myADT
- myADT.intepret() -> ouptut
In yacc, there's int yyparse(void)
, it seems relying the yyin
varaible. Is there any way I can directly parse a string, without these magical global variables?
没有评论:
发表评论