Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I parse a C string (char *) with flex/bison?

In my programming project I want to parse command line attributes using flex/bison. My program is called like this:

./prog -a "(1, 2, 3)(4, 5)(6, 7, 8)" filename

Is it possible to parse this string using flex/bison without writing it to a file and parsing that file?

like image 967
Philipp Riegger Avatar asked Nov 25 '10 17:11

Philipp Riegger


People also ask

What parse strings?

Parsing String is the process of getting information that is needed in the String format. String parsing in java can be done by using a wrapper class. Using the Split method, a String can be converted to an array by passing the delimiter to the split method. The split method is one of the methods of the wrapper class.

What do you mean by Flex lex yacc and bison?

Lex and Yacc were the first popular and efficient lexers and parsers generators, flex and Bison were the first widespread open-source versions compatible with the original software. Each of these software has more than 30 years of history, which is an achievement in itself.


1 Answers

See this question String input to flex lexer

like image 101
epatel Avatar answered Sep 27 '22 21:09

epatel