Professional Documents
Culture Documents
Explain lex and yacc tools:Lex:- scanner that can identify those tokens
Yacc:- parser.yacc takes a concise description of a grammar and produces a C routine that can
parse that grammar.
2) give the structure of the lex program:definition section- any intitial c program code
%%
Rules section- pattern and action separated by white space
%%
User subroutines section-concsit of any legal code.
3) The lexer produced by lex in a c routine is called yylex()
4) Explain yytext:- contains the text that matched the pattern.
5) The yacc produced by parser is called yyparse().
6) Why we have to include y.tab.h in lex?
y.tab.h contains token definitions eg:- #define letter 258.
7) explain the structure of a yacc program?
Defn section- declarations of the tokens used in the grammar
%%
The rules section-pattern action
%%
Users subroutines section
8) Explain yyleng
Yyleng-contains the length of the string our lexer recognizes.
9) Features of unix:-multitasking,mutiuser,online help facility,security,file & process.
10) What is an internal command? give an example?
Command which is shell built-in eg:echo
11) What is an external command?give a example?
Command which resides in other directories-eg:cd in /bin
12) What is an absolute path name?give an example?
A file name identification with respect to the root. Eg:- /home/kumar/f1