Thread overview
Flex file for the D programming language
Dec 30, 2005
Casper Ellingsen
Dec 30, 2005
J C Calvarese
Dec 30, 2005
Manfred Nowak
Dec 31, 2005
Casper Ellingsen
Dec 31, 2005
Manfred Nowak
Dec 30, 2005
Chris Lajoie
Dec 31, 2005
Casper Ellingsen
Dec 30, 2005
Carlos Smith
Dec 31, 2005
Casper Ellingsen
Dec 31, 2005
Carlos Smith
December 30, 2005
I need a flex file for the D programming language. So, I was just wondering of anyone of you guys know where I can find an already existing one? Or do I have to make one from scratch?

Casper
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
December 30, 2005
In article <op.s2lmqbuge7y2tg@casper.c-map.no>, Casper Ellingsen says...
>
>I need a flex file for the D programming language. So, I was just wondering of anyone of you guys know where I can find an already existing one? Or do I have to make one from scratch?
>
>Casper

(I assume you mean this flex: http://www.gnu.org/software/flex/)

I don't think I've heard of anyone creating a flex file for D because I think if I had heard of such an effort I would've added a mention to this wiki page: http://www.prowiki.org/wiki4d/wiki.cgi?GrammarParsers

jcc7
December 30, 2005
Casper Ellingsen wrote:

> I need a flex file for the D programming language.
[...]

Never heard that flex does support unicode. If flex does not support unicode then only a subset of D can be read.

-manfred
December 30, 2005
Casper Ellingsen wrote:
> I need a flex file for the D programming language. So, I was just wondering of anyone of you guys know where I can find an already existing one? Or do I have to make one from scratch?

I have a mostly complete lexer written for ANTLR. It shouldn't be too
hard to convert to flex, but I recommend you rewrite each rule
individually to make sure I didn't screw up ;) (let me know if I did and
it's not noted in the comments).
Anything that is not handled correctly by my ANTLR lexer (that I am
aware of) is noted in a comment prefixed with TODO: or BUG:. I have
tried it on several of the largest files in phobos and it scanned each
of them correctly, so it is complete enough for most D files.

I understand there was another project doing this noted in the wiki, but it has been a dead link for some time now.

Chris



December 30, 2005
> I need a flex file for the D programming language. So, I was just wondering of anyone of you guys know where I can find an already existing one? Or do I have to make one from scratch?

I wrote one some months ago.
Was quite complete at the time, but needs some
work to make it up to date.

Must search it, when found will post it here,
tonight ( now it is 18h40 in Quebec City ).

Carlos



December 31, 2005
On Sat, 31 Dec 2005 00:38:13 +0100, Carlos Smith <carlos.smith@sympatico.ca> wrote:

>> I need a flex file for the D programming language. So, I was just
>> wondering of anyone of you guys know where I can find an already existing
>> one? Or do I have to make one from scratch?
>
> I wrote one some months ago.
> Was quite complete at the time, but needs some
> work to make it up to date.
>
> Must search it, when found will post it here,
> tonight ( now it is 18h40 in Quebec City ).
>
> Carlos

Sounds good. Let me know if you find it.
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
December 31, 2005
On Sat, 31 Dec 2005 00:01:12 +0100, Chris Lajoie <ctlajoie___remove___this___@___gmail.com> wrote:

> Casper Ellingsen wrote:
>> I need a flex file for the D programming language. So, I was just
>> wondering of anyone of you guys know where I can find an already
>> existing one? Or do I have to make one from scratch?
>
> I have a mostly complete lexer written for ANTLR. It shouldn't be too
> hard to convert to flex, but I recommend you rewrite each rule
> individually to make sure I didn't screw up ;) (let me know if I did and
> it's not noted in the comments).
> Anything that is not handled correctly by my ANTLR lexer (that I am
> aware of) is noted in a comment prefixed with TODO: or BUG:. I have
> tried it on several of the largest files in phobos and it scanned each
> of them correctly, so it is complete enough for most D files.
>
> I understand there was another project doing this noted in the wiki, but
> it has been a dead link for some time now.
>
> Chris
>

Thanks! I'll wait and see what Carlos finds first, and then possible use yours as a base for my flex grammar file. Either way, I'll post my file once it's done for others to use.
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
December 31, 2005
On Fri, 30 Dec 2005 21:03:20 +0100, Manfred Nowak <svv1999@hotmail.com> wrote:

> Casper Ellingsen wrote:
>
>> I need a flex file for the D programming language.
> [...]
>
> Never heard that flex does support unicode. If flex does not support
> unicode then only a subset of D can be read.
>
> -manfred

I'm pretty sure flex supports unicode. Correct me if I'm wrong though.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
December 31, 2005
Casper Ellingsen wrote:

[...]
> I'm pretty sure flex supports unicode. Correct me if I'm wrong though.

That reads as if you are not willing to do any tests yourself prior to acquiring help from the community.

The flex of my cygwin installaton, which is up to date, creates lexers, that read into an `extern char* yytext;'.

Maybe we have different definitions for "support".

-manfred
December 31, 2005
"Casper Ellingsen" <no@reply.com> wrote in message news:op.s2lmqbuge7y2tg@casper.c-map.no...
> I need a flex file for the D programming language. So, I was just

I found the files. (dated March 2005)
Using flex 2.5.4 and bison 2.1 from the MingW32 distribution.

D.y is an almost empty grammar for D. Just enough
to allow bison to produce a header for the tokens.

# bison -d -odtab.c d.y
will produce dtab.h

# flex -Cem -Bs8 -odlex.c d.l
will produce dlex.c

# gcc -O2 -DYYMAIN -odlex.exe -s
gives a program to test.

# dlex < somefile.d
produce a list of tokens on stdout.

Carlos