English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] otags problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-05 (09:31)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] LL, LR, and camlp4 (was Re: syntax change)

On Tue, Feb 05, 2002 at 01:09:11AM -0800, Chris Hecker wrote:

> My question is just why did you hand-write the parser, rather than
> using a tool like yacc?

To preserve the extensibility with a simple way. I could not do that
with a yacc parser except revisiting the whole grammar and rebuiding
the whole table when extensions are done.

In Camlp4, when you extend an "entry level", only the entry level is
modified: an extension is just adding a rule in a tree, like adding a
case in a function. It is simple and I want to keep that simplicity.

> Are parser generators not all they're cracked up to be?  If so, why
> does caml use yacc?

I don't know: when I arrived 10 years ago, there was nothing by yacc.
and for most people:
           parsing <=> yacc

Not for me. I don't agree with that. I discovered parsing by learning
Pascal, 25 years ago and I found amazing the rules:

   expression ::= term + term
                | term - term
         term ::= factor + factor
                | factor - factor
       factor ::= integer
                | variable
                | ( expression )
I found this recursivity with "expression between parentheses" as a
marvelous thing... :-)

When I arrived here, I just combined this idea with the Caml language
and its polymorphism, and I wrote the stream parsers, using Michel
Mauny's ideas.

Extensible grammars of Camlp4 are just improved stream parsers.

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr