Problem with flex++/bison++

T

Tom Heathcote

Apologies for posting a flex++ question rather than a C++ question, but
there does not appear to be a flex++ newsgroup...

I am trying to rebuild some old lexical scanner / analyzer code,
which I believe was generated by flex++/bison++.

The rebuild is required because existing code is only a 7-bit scanner
(uses char rather than unsigned char as its character type, and the
tables only go up to 127) and I need to work with 8-bit input.

However when I try to regenerate the code, flex++ does not seem to
understand some of the syntax in the .l file. The file starts out as
follows:

/* (a load of comments first) */

%name JobRunScan

%define LEX_PARAM \
YY_JobRunParse_STYPE* value, \
YY_JobRunParse_LTYPE* loc

%define MEMBERS \
public: \
int line() const \
{ return m_line; } \
\
private: \
istream* m_cin; \
int m_line;


But flex++ just comes up with a load of errors:

"JobRunScan.l", line 27: bad character: %
"JobRunScan.l", line 27: unknown error processing section 1
"JobRunScan.l", line 27: unknown error processing section 1
"JobRunScan.l", line 27: unknown error processing section 1
"JobRunScan.l", line 29: unrecognized '%' directive
"JobRunScan.l", line 33: unrecognized '%' directive
"JobRunScan.l", line 37: bad character: \

It simply does not recognize either %name or %define as valid.

I have tried searching Google for some relevant information, and I found
some examples that imply that this is correct flex++ syntax. But I
didn't come up with any solutions... (it doesn't help that most search
engines don't let you search for terms containing a percent sign).

Does anyone have any idea what I might be doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top