awk lex yacc (beginner question) 
Author Message
 awk lex yacc (beginner question)

hi all,

i had to do a search and replace assignment and sed did it just fine for me.
(thanks to this ng as well)

please let me know as to when would one use lex yacc awk.

i am asking because these are tools and tools are for getting something ie
your assignment or work done efficiently. right ?? hence in this context
please let me know a typical application where one has used lex/
yacc/awk/sed
(for sed i just did a small job with about 500 test files and realised how
powerful it was)

thanks



Mon, 18 Aug 2003 16:56:57 GMT  
 awk lex yacc (beginner question)

Quote:
> hi all,

> i had to do a search and replace assignment and sed did it just fine for
me.
> (thanks to this ng as well)

> please let me know as to when would one use lex yacc awk.

> i am asking because these are tools and tools are for getting something ie
> your assignment or work done efficiently. right ?? hence in this context
> please let me know a typical application where one has used lex/
> yacc/awk/sed
> (for sed i just did a small job with about 500 test files and realised how
> powerful it was)

I very much doubt you will have a use for 'yacc' and 'lex', at least in the
near future. They are not your typical 'general purpose' utilities, in the
way, that, for example, 'grep' and 'sed' are, but are very highly
specialised tools.

The term 'yacc' is an acronym for 'yet another compiler compiler', and is,
essentially, a tool which accepts a formal description of a language as
input, and generates, as output, code to 'parse' programs written in that
language. In other words, 'yacc' generates a parser which you can
incorporate into the compiler / interpreter / language processor program you
are building.

The term 'lex' is a shortened form for 'lexical analyser', and is a tool
which accepts, as input, a description of the symbols that your language
consists of. The output is generated C code that will read text that is fed
to it, and 'tokenise' that text, that is, correctly break it down into the
valid symbols of that language and other text, ready for further processing.
As with 'yacc', you incorporate the generated code into your compiler /
interpreter / language processor program.

The 'awk' utility, however, is a *very* general purpose, powerful and
versatile tool. It combines the power of 'sed', 'grep', 'tr', 'cut', 'paste'
and other utilities into a single, easy-to-use, package. It utilises a
simple, C-like language, and may be used for tasks such as text extraction /
text manipulation / report generation and prototyping, that is, quickly
testing algorithms. If you wish to spend time learning a *NIX tool, then
'awk' would certainly be it.

In general, a typical *NIX system may be seen as a collection of tools, some
quite general purpose, others quite specialised. It is probably wise if you
become familiar with some of the more common utilities:

* grep            * find              * cut                 * paste
* tr
* sed             * awk              * head             * tail
* cat
* ls                 * chmod         * rm                 * mv
* cp

Mastering a more powerful tool such as 'awk' might come next, followed by
shell scripting. Other things, such as the more specialised tools, are
probably best learned on an 'as needed' basis.

What more can I say ? Welcome to the world of *NIX ! Enjoy !

I hope this helps.



Mon, 18 Aug 2003 19:57:45 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. lex / yacc question...

2. lex & yacc questions

3. Q: Lex&YACC smalltalk version ?

4. LEX and YACC in Smalltalk

5. lex/yacc

6. Lex & Yacc for Smalltalk

7. Yacc/Lex Description of Eiffel v3

8. lex and yacc with Eiffel

9. lex, and yacc spec for eiffel ?

10. LEX-YACC interfacing with Eiffel

11. Harbour Project | Lex & Yacc Guide

12. Clipper lex & yacc and parser, build 8

 

 
Powered by phpBB® Forum Software