lex yacc programming
hey i just want to learn more about lex and yacc programming in ubuntu as my final year project is based on it
in that i have to detect for loop in c program which can be pass using lex and yacc tool of linux and then it will insert openmp pragmas in to that c programm so that the c program shuld be parallelly executed..
lex and yacc are ineffective tools for real world problems.
When parsing a very clean grammar, they are a convenient resource. But the uglier the grammar the harder it is to contort lex and yacc to handle it.
It quickly becomes easier to just code a parser in a general purpose language than to kludge the problem spots into lex and yacc.
In a typical academic project involving lex/yacc you get to define the target language, so lex and yacc show their one true value: If you are designing the language and the parser at the same time and you have trouble using lex and yacc, it likely means you are making poor choices in language design and use of lex an yacc may push you to better language design. But if someone else already designed the language, the language design choices that turn lex and yacc into a giant problem have already been made.
I think ANTLR is far better than lex/yacc. But that doesn't necessarily mean I recommend ANTLR. Having used lex/yacc, and ANTLR and simply coding a parser in C++ without any parser specific tools, I have always found that the last of those choices yields the least long term difficulty. ANTLR or lex/yacc may save a lot of boring work on the easy parts of the language. But as you dig into the hard parts of the language you are supporting, you over pay wildly for that initial benefit.
Superficially, it may appear that recognizing for loops is a much smaller problem than parsing the whole language. But most ways of taking advantage of that smaller size lead to designs that can be tricked. An academic project may allow work that is only mostly correct. But in my opinion a more practical project that can be done correctly is a better exercise.
I assume you do not mean it will automatically detect loops for which an openmp pragma could be added without corrupting the answer. That would be impossible to do accurately.
Do you mean adding openmp pragma even in places where doing so would cause the program to crash (once compiled and run with openmp support)?
thanks sir for suggesting ANTLR....before ur reply i really dnt knoew abt ANTLR...but noe i think it is good tool rather using lex yacc for parsing
can anyone tell me how to install gtk on ubuntu 11.04?
i have install it ie (libgtk-3-dev) using synaptic package manager but after executing the code
it gives an error msg as follows:
fatal error:gtk/gtk.h no such file or directory
GTK2 : package name = libgtk2.0-dev
Using gtk2, example ..
gcc -Wall -g infile.c -o outfile `pkg-config --cflags gtk+-2.0` \
`pkg-config --libs gtk+-2.0`
Gtk2, gtk3 :
|All times are GMT -5. The time now is 08:38 PM.|