cons-discuss
[Top][All Lists]
Advanced

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

Re: compiling flex & bison files


From: Johan Holmberg
Subject: Re: compiling flex & bison files
Date: Mon, 18 Feb 2002 13:56:48 +0100 (MET)

On Fri, 15 Feb 2002, Artem Kulakov wrote:
>
> What is the best way to compile flex and bison files using ConsPlus?
>
> Do people use Language or a set of Command calls?
>

I made Cons::Plus and the "Language" command to make it easy to
"compile" things like assembler-files, and the Resource-files (on
Win32), ie. to get away from  the too C/C++-centric setup of vanilla
Cons.

But I did *not* think specifically about flex/bison when making
Cons::Plus.

I haven't thought much about the best way to integrate flex/bison
into Cons (or Cons::Plus), but how about this:

Wouldn't it be nice if one could write like below ?

    use Cons::Plus;
    $e = Cons::Plus->new(...);

    $e->Program("myprog", "myprog.c", "myscanner.l", "myparser.y");


This should be translated to something like:

    - "myscanner.l" ---> "myscanner.c" by running "flex"
      (or a better named file, but "lex.yy.c" seems wrong; what if
       we have two scanners ??? )

    - myparser.y ---> myparser.tab.c AND myparser.tab.h
      by running bison.

    - "myscanner.c" and "myparser.tab.c" should be added as normal
      C files and be compiled/linked the same way as "myprog.c".

    - "myparser.tab.h" should be marked as using 'content' signature
      to avoid unnecessary rebuilds "downstreams".


This would require some changes to the "Program/Objects" methods,
but Cons::Plus already does similar things, so I guess it would be
possible.

But I don't know how to selectively specify 'content' signature for
a specific file. Specifying it with the SIGNATURE variable seems
like the wrong way to do it (too "global").
Maybe I just have missed how to do this ?

Any comments on the possible solution described above ?

/Johan Holmberg





reply via email to

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