Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Development Tools<br />
TAR<br />
tar cf files.tar dirname # create tar of files<br />
tar tvf files.tar<br />
# full view of files in tar<br />
compress files.tar # compress (tree archive)<br />
uuencode files.tar.Z files.tar.Z > files.tar.Z.uu<br />
elm -s "files.tar.Z.uu" neville < files.tar.Z.uu<br />
uudecode files.tar.Z.uu | uncompress | tar xvf –<br />
#extract files<br />
O<strong>the</strong>r compression tools such as "freeze“, "zoo", "zip", "jpeg" are freely available for UNIX systems.<br />
Program Development<br />
yacc a parser generator – generates a parser from a grammatical description of a language<br />
make controlling <strong>the</strong> processes by which a complicated program is compiled<br />
lex making lexical analysers<br />
Example: A simple calculator<br />
4*3*2<br />
24<br />
355/113<br />
3.1415929<br />
(1+2)*(3+4)<br />
Grammar:<br />
21 list: expr \n<br />
list expr \n<br />
expr: NUMBER<br />
expr '+' expr<br />
expr '-' expr<br />
expr ’*' expr<br />
expr '/' expr<br />
'(' expr ') '<br />
YACC<br />
Yet Ano<strong>the</strong>r Compiler-Compiler. Yacc is a powerful tool. It takes some effort to learn. Yacc-generated parsers are<br />
small, efficient and correct.<br />
- write <strong>the</strong> grammar<br />
- each rule of grammar can have an action written in C – this defines <strong>the</strong> semantics<br />
- a lexical analyser (LEX) to break input into meaningful chunks (token) for <strong>the</strong> parser<br />
- a controlling routine to call <strong>the</strong> parser that yacc built<br />
- Input to yacc:<br />
%{<br />
C statements like #include, declarations<br />
%}<br />
yacc declarations: lexical tokens, grammar variables, precedence and<br />
associativity information<br />
%%<br />
grammar rules and actions<br />
%%<br />
more C statements<br />
main() { ...; yyparse(); …}<br />
yylex() { … }<br />
/*<br />
$ yacc hocl.y<br />
$ cc y.tab.c -o hocl<br />
61