delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/10/10:46:54

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: Bison Vs. Flex?
Date: Wed, 9 Jun 1999 10:28:35 -0600
Message-ID: <01beb295$1f65f780$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com


>What is the difference between Bison And Flex? (for djgpp).  I know That
>flex can make compilers for languages, but what about bison.  is it a
>parser?  Can I use one of these to parse thru a script language(that I
>made) without having to program the 'if', 'else', 'then', ect?  and
>without programming the variable interaction, like assign and make
>variables?



they're complimentary.  Flex is a lexical analysis tool, and Bison is a
parser generator.

Flex examines a stream of characters for a set that matches it's input
constraints, e.g., say you want a token that looks like this:  'if', Flex
would search the stream for that token.

Then, inside Bison, you could have a state that needs the token 'if', but
you call it tIF in Bison. in other words:

Flex's command would be:

if    return(tIF);

and Bison's would be:

ifstatement:    tIF '(' tEXPRESSION ')' block        { /* this is the action
that Bison performs if it matches all those tokens. */ }
        ;

    -={C}=-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019