hi
i'm writting a program by lex and yacc. i want to add some invariants in some special of an input file. my expected output is the same input file while some invaraints are place through statements.how can i do it? i can transfor the input file to output in lex but the order of invaraints and statements is not right . i want the invaraint placed before the statement.any suggestion?
zahra123
0
Newbie Poster
Recommended Answers
Jump to PostWhat kind of invariants are you thinking about here?
Jump to PostI have used Lex and Yacc and hate them! Part of the problem is that writing parsing rules is not trivial, and the other part is that they generate in-line code that cannot be easily modified - any changes are wiped out the next time you generate the code. My …
Jump to PostPart of the problem is that writing parsing rules is not trivial
I think that is the crux of the matter.
lex
andyacc
are fine tools for writing a parser/generator. The nature of languages and their compilation is that they are largely static don't often change.…
Jump to PostIt is hard to describe your problem without seeing an example of your code. Language parsing is non-trivial and there are many things that you may need to do to get the results you want.
With that being said, here is a simplified example of what I mean.
File: example.l
…
All 15 Replies
Nutster
58
Newbie Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
zahra123
0
Newbie Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
L7Sqr
227
Practically a Master Poster
zahra123
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.