Search code examples
commandargumentslineyaccflex-lexer

Flex and Bison, parse command line arguments


I'm using Flex and Bison, and I would like my lex/parse to analyse text from command line, for example if I have : mybin mytext , I would like my yyparse to analyse mytext (which is not a file)


Solution

  • Use yy_scan_string to set the flex input buffer to a specified string (argv[1] in this case). See the flex manual for details.