The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

UNIX-SYSTEMS-PROGRAMMING-AND-COMPILER-DESIGN-LABORATORY-10CSL68--->View question


Asked On2017-12-19 15:50:30 by:leo

Taged users:
13priyaSalomon-Dalmet

Likes:
Be first to like this question

Dislikes:
Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions
Answers
                      
LEX
-Lex is officially known as a "Lexical Analyser".
-Its main job is to break up an input stream into more usable elements. Or in, other words, to identify the "interesting bits" in a text file.
-For example, if you are writing a compiler for the C programming language, the symbols { } ( ); all have significance on their own.
-The letter a usually appears as part of a keyword or variable name, and is not interesting on its own.
-Instead, we are interested in the whole word. Spaces and newlines are completely uninteresting, and we want to ignore them completely, unless they appear within quotes "like this"
-All of these things are handled by the Lexical Analyser.
-A tool widely used to specify lexical analyzers for a variety of languages
-We refer to the tool as Lex compiler, and to its input specification as the Lex language.

How does this Lexical analyzer work?
The lexical analyzer created by Lex behaves in concert with a parser in the following manner.
When activated by the parser, the lexical analyzer begins reading its remaining input, one character at a time, until it has found the longest prefix of the input that is matched by one of the regular expressions p.
Then it executes the corresponding action. Typically the action will return control to the parser.
However, if it does not, then the lexical analyzer proceeds to find more lexemes, until an action causes control to return to the parser.
The repeated search for lexemes until an explicit return allows the lexical analyzer to process white space and comments conveniently.

YACC
-Yacc is officially known as a "parser".
-It's job is to analyse the structure of the input stream, and operate of the "big picture".
-In the course of it's normal work, the parser also verifies that the input is syntactically sound.
-Consider again the example of a C-compiler. In the C-language, a word can be a function name or a variable, depending on whether it is followed by a (or a = There should be exactly one } for each { in the program.
-YACC stands for "Yet another Compiler Compiler". This is because this kind of analysis of text files is normally associated with writing compilers.

How does this yacc works?
yacc is designed for use with C code and generates a parser written in C.
The parser is configured for use in conjunction with a lex-generated scanner and relies on standard shared features (token types, yylval, etc.) and calls the function yylex as a scanner coroutine.
You provide a grammar specification file, which is traditionally named using a .y extension.
You invoke yacc on the .y file and it creates the y.tab.h and y.tab.c files containing a thousand or so lines of intense C code that implements an efficient LALR (1) parser for your grammar, including the code for the actions you specified.


Answerd on:2018-06-06 Answerd By:aksingh1818

Likes:
|aksingh1818

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

Stay home and watch eduladder premium videos for free In at this qurentine.


You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here



Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder