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
Re: [Caml-list] Using Frontc
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-11-24 (10:26)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Using Frontc
On Thu, 2005-11-24 at 14:12 +0800, Zhu Ping wrote:

> /home/dreamer/code/sample1.c[1] Invalid symbol: int main(int base, int
> expon)
> /home/dreamer/code/sample1.c[2] Invalid symbol: {

Spurious CR by any chance? Only one error per line here.
Weird though, it should handle it.

Anyhow the reason it works is simple enough: the parser
is called 'initial' and here is the rule in question:
|    _        {E.parse_error
      "Invalid symbol"
     (Lexing.lexeme_start lexbuf)
    (Lexing.lexeme_end lexbuf);
   initial lexbuf}

so you can see it emits a diagnostic .. and then continues
by recursively calling itself again .. ignoring the error.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net