By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 899 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

Problem with flex++/bison++

P: n/a

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

/* (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?

Tom Heathcote
Jul 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.