Tuesday, April 5, 2016

Compiler Lab stuff. Material for Lex and Yacc

Why does your lexical analyzer recognize "int" as an identifier ? What is wrong with your Lex code or your computer ? How do you pass a file as an input to your lexical analyzer ?

Why do you get "shift/reduce conflicts" warning ? What is yylval ? What is YYSTYPE ? What is the weird error related to YYSTYPE you got in your program ? Have you included the necessary files ? Have you included them just once or twice by mistake ? Is there a problem in your compilation method instead of the main logic code ? What are the different ways to compile ? Some ways ( options in commands ) work only in Ubuntu and other Linux systems and not in Mac ?
Ever had any of these doubts or thought about these ? If yes, mail me! Teach me! If no, it simply means we gotta learn stuff to know more.

Now, are you worried about Lab models and Sem Lab practicals? Let's be frank, if you are worried, you are worried either because you coded only a few programs, or never coded at all. Or have tons of doubts. Which sounds fine.
My smart advice would be, learn stuff at least at an abstract level, and have enough knowledge in theory to code the main logic. For this you need preparation ahead of models exam. Or if you are the super smart person, you could learn all the code the day before models and Sem Lab practicals.
Back to Lex and Yacc stuff. Below are some articles I found useful. I only read a few of them. Yet to read others.

http://www.tldp.org/HOWTO/Lex-YACC-HOWTO.html

Particularly this :
http://www.tldp.org/HOWTO/Lex-YACC-HOWTO-6.html#ss6.3
Then this ( a famous one in Google results) :
epaperpress.com/lexandyacc/download/LexAndYaccTutorial.pdf

http://dinosaur.compilertools.net/
Two good videos that I saw :
https://www.youtube.com/watch?v=54bo1qaHAfk
https://www.youtube.com/watch?v=__-wUHG2rfM
I will update more, in the future, if I find anything.
Share the material with interested people! :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.