Compilers, Interpreters in C

Compilers, Interpreters in C

Post by Ralph Silverm » Tue, 16 Jul 1996 04:00:00



: Hi,
:     I've tried several times to program a simple interpreter that
: simply takes in a file and string compare it to a selected group of
: options and return a specify data.  But never got it right.  Can you
: actually program a Compiler or Interpreter in C?  Can you?  Or else,
: what other languages needed to be used?  And How hard is it to program
: a compiler or interpreter?  Answere any questions you want.  Thanks.

: ----

--
*************begin r.s. response****************

        1)
                the 'c' programming language
                originated as a
                        'system programming language'
                (for the like of operating systems
                 compilers and interpreters...)
                and is superb for such purposes!

        2)
                generally,
                system programming on this level
                is very sophisticated and demanding
                work!!!

*************end r.s. response******************
Ralph Silverman

 
 
 

Compilers, Interpreters in C

Post by Christian Lun » Thu, 18 Jul 1996 04:00:00



>: Hi,
>:     I've tried several times to program a simple interpreter that
>: simply takes in a file and string compare it to a selected group of
>: options and return a specify data.  But never got it right.  Can you
>: actually program a Compiler or Interpreter in C?  Can you?  Or else,
>: what other languages needed to be used?  And How hard is it to program
>: a compiler or interpreter?  Answere any questions you want.  Thanks.

>: ----


If You are really interested, how about using lex and yacc (or their GNU equivalents flex and bison) ?

lex is a lexical analyzer to divide Your input into tokens using  regular expressions to identify the tokens.
yacc then checks the syntax of Your input tokens and does the processing using a kind of
Backus/Naur notation.

Both programs produce C-source code which Your can link to Your program.

For further information there is an excellent book from O'Reilly: Lex and Yacc.

So long

Chris

Christian Lunau, System Engineer, Vicorp Geminus GmbH

 
 
 

Compilers, Interpreters in C

Post by Ralph Silverm » Fri, 19 Jul 1996 04:00:00


: >

: >: Hi,
: >:     I've tried several times to program a simple interpreter that
: >: simply takes in a file and string compare it to a selected group of
: >: options and return a specify data.  But never got it right.  Can you
: >: actually program a Compiler or Interpreter in C?  Can you?  Or else,
: >: what other languages needed to be used?  And How hard is it to program
: >: a compiler or interpreter?  Answere any questions you want.  Thanks.
: >
: >: ----

: >

: If You are really interested, how about using lex and yacc (or their GNU equivalents flex and bison) ?

: lex is a lexical analyzer to divide Your input into tokens using  regular expressions to identify the tokens.
: yacc then checks the syntax of Your input tokens and does the processing using a kind of
: Backus/Naur notation.

: Both programs produce C-source code which Your can link to Your program.

: For further information there is an excellent book from O'Reilly: Lex and Yacc.

: So long

: Chris

: Christian Lunau, System Engineer, Vicorp Geminus GmbH

--
************begin r.s. response**************

        yes,
        but,
        in terms of the development of
        a
                software engineer
        ,
        some work developing parsers,
        and the like,
        with a lower level language,  like
                the 'c' programming language
        ,
        should proceed the use of automated generators.

************end r.s. response****************
Ralph Silverman

 
 
 

Compilers, Interpreters in C

Post by Andrew Gier » Sat, 20 Jul 1996 04:00:00


[This thread should never have been injected into comp.unix.programmer.
Would people responding *please* take note. Followups set.]




>:|>      yes,
>:|>      but,
>:|>      in terms of the development of
>:|>      a
>:|>              software engineer
>:|>      ,
>:|>      some work developing parsers,
>:                             ^^^^^^^
>:|>      and the like,
>:|>      with a lower level language,  like
>:|>              the 'c' programming language
>:|>      ,
>:|>      should proceed the use of automated generators.
>:In the case of parsers, boycotting generators such as yacc is only an
>:option when the grammar in question is simple (i.e., LL(1)-compliant)
>:and the programmer (student) can generate an equally simple recursive
>:descent parser.  Parsers for more complex grammars (i.e. LALR(1)) are
>:far too tedious and difficult to generate "by hand."
>:I do agree, though, that students new to language translation and
>:compilers in general should be exposed to the nuances of a hand-made
>:RD parser before they move on to bigger and better things (and bigger,
>:better, and more capable grammars.)
>It depends. if you are using regular languages for teaching, lex may be
>a good thing to use. It's really fun to write finite state machines in
>lex. And if you got the chance to define your own language you should
>try a regular one first anyway.
>Volker

 
 
 

Compilers, Interpreters in C

Post by Volker Hetz » Sat, 20 Jul 1996 04:00:00



:|>  yes,
:|>  but,
:|>  in terms of the development of
:|>  a
:|>          software engineer
:|>  ,
:|>  some work developing parsers,
:                             ^^^^^^^
:|>  and the like,
:|>  with a lower level language,  like
:|>          the 'c' programming language
:|>  ,
:|>  should proceed the use of automated generators.

:In the case of parsers, boycotting generators such as yacc is only an
:option when the grammar in question is simple (i.e., LL(1)-compliant)
:and the programmer (student) can generate an equally simple recursive
:descent parser.  Parsers for more complex grammars (i.e. LALR(1)) are
:far too tedious and difficult to generate "by hand."

:I do agree, though, that students new to language translation and
:compilers in general should be exposed to the nuances of a hand-made
:RD parser before they move on to bigger and better things (and bigger,
:better, and more capable grammars.)

It depends. if you are using regular languages for teaching, lex may be
a good thing to use. It's really fun to write finite state machines in
lex. And if you got the chance to define your own language you should
try a regular one first anyway.

Volker

 
 
 

Compilers, Interpreters in C

Post by Chris Engebrets » Sat, 20 Jul 1996 04:00:00



|>   yes,
|>   but,
|>   in terms of the development of
|>   a
|>           software engineer
|>   ,
|>   some work developing parsers,
                             ^^^^^^^
|>   and the like,
|>   with a lower level language,  like
|>           the 'c' programming language
|>   ,
|>   should proceed the use of automated generators.

In the case of parsers, boycotting generators such as yacc is only an
option when the grammar in question is simple (i.e., LL(1)-compliant)
and the programmer (student) can generate an equally simple recursive
descent parser.  Parsers for more complex grammars (i.e. LALR(1)) are
far too tedious and difficult to generate "by hand."

I do agree, though, that students new to language translation and
compilers in general should be exposed to the nuances of a hand-made
RD parser before they move on to bigger and better things (and bigger,
better, and more capable grammars.)

Regards,

--
/*-------------------------------------------------------------
Chris Engebretson // CSB - SED - Scientific Systems Development
United States Geological Survey   -   National Mapping Division
Mundt Federal Building, USGS EROS Data Center
Sioux Falls, SD 57198  http://edcwww.cr.usgs.gov/eros-home.html

-------------------------------------------------------------*/

 
 
 

1. Seeking a BASIC Interpreter/compiler that has IP network functions

Hi,

I'm looking for a high level BASIC-like language for Linux that has
TCP/IP socket-like functions. I've tried to learn C and Pearl but never
seem to find it within myself to become proficient in these languages.
I also find them to be a bit cryptic. I guess I just lack the talent to
be an Uber programmer.

I have, however,  done a good bit of bash shell and basic programming
in my days. What I need is a programming language for mere mortals that
supports the same (or similar) socket type functions that Perl has.

Thanks.

Sent via Deja.com http://www.deja.com/
Before you buy.

2. byte-benchmark.x86sol.tar.gz

3. Prolog interpreter/compiler

4. -prune regexp for gnu find/locate/updatedb doesn't work - why?

5. where can I get a non-chipmunk basic compiler/interpreter?

6. Hitachi, Microsoft tie up in corporate software

7. HELP - ML interpreter/compiler?

8. close a socket

9. Which Pascal Interpreter (compiler) for Solaris (x86) is good??

10. Need BASIC interpreter / compiler

11. JAVA Compiler/Interpreter

12. Mumps interpreter and Compiler

13. FORTH interpreter/compiler for linux?