help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some more help..


From: Hans Aberg
Subject: Re: Some more help..
Date: Wed, 1 May 2002 10:36:52 +0200

Reply-To: Bison Help <address@hidden>

At 22:53 -0700 2002/04/30, Deepak Modi wrote:
> Hi,
>  iam sorry i didn't get it...let me redefine my question...but first let
>me put dowm my understanding about FLEX,BISON...correct me if iam wrong..
>  I need to develop a compiler based on certain rules,functions...so i
>first write the grammer for the rules,functions..then i feed this grammer
>as input to FLEX..my FLEX will parse this and generate 'tokens' which be
>the input to BISON...the BISON in turn will convert this tokens to a
>'c-language code'..when i build this 'c-language code'(how do i build is
>one more question..??) i finally get a executable..say comp.exe...

This way you finally get an executable that will parse the language you put
into Flex/Bison. In addition, if you want your parser to do something, you
need to define a language semantics. This is done by attaching an action to
each rule in the .y grammar. These actions are also written in C with the
extension of certain symbols (like $$, $n), and will be copied in to the
.tab.c parser file that Bison outputs. Thus, these actions will be fully
integrated into your executable.

The parser that Bison generates from the .y grammar will apply the
corresponding rule action whenever it finds a corresponding full rule to
"reduce" (as it is called in bottom-up parsing lingo).

See the Bison manual for examples; for example, the calculator there.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]