From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA05880; Tue, 22 Oct 2002 23:16:42 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA04820 for ; Tue, 22 Oct 2002 23:16:41 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9MLGJ502642; Tue, 22 Oct 2002 23:16:19 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA05792; Tue, 22 Oct 2002 23:16:19 +0200 (MET DST) From: Pierre Weis Message-Id: <200210222116.XAA05792@pauillac.inria.fr> Subject: Re: [Caml-list] Query: email parser in ocamllex/ocamlyacc In-Reply-To: <001a01c279d7$2555e170$c80a0ac3@amelia> from Vincent Leleu at "Oct 22, 102 03:27:20 pm" To: vincent@leleu.info Date: Tue, 22 Oct 2002 23:16:19 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Version Francaise a la fin > ------------------------------ > > Hello, > > I'm writting an ocamllex/ocamlyacc based application that extracts a list> of emails embedded in a text/html file. > Would anyone of you know of any available implementation I could get > inspiration from (and save some time!). Really precise parsing of email messages requires implementing the RFC822 (more precisely RFC2822 nowadays), which is not a trivial task. I started to do it but gave up due to the absence of a scanf facility. I launched a thread to implement scanf, and 5 years after I understood how to do it in the Caml system! Now that we have scanf, I could go on to implement RFC(2)822. But don't hold your breath: if you don't need a full parser for mail messages the simpler way is to write a (false but trivial) approximation with a lexer... There may be such a program into Xaviers's spamoracle ? Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ > ------------------------------- > > Bonjour, > > Je suis en train d'ecrire une application basee sur ocamllex/ocamlyacc. > L'application est destinee a extraire les emails (vers une structure list>) contenus dans un texte ou document html. > > Quelqu'un sait-il si une implementation de ceci existe deja afin que je > puisse m'en inspirer (et economiser mon temps!). L'analyse syntaxique précise des messages électroniques nécessite l'implémentation de la RFC822 (plus précisément la RFC2822 maintenant), ce qui n'est pas trivial. J'ai essayé une fois mais j'ai arrêté à cause de l'absence d'une fonction scanf. J'ai alors lancé une sous-tâche: implémenter scanf, et 5 ans après j'ai enfin compris comment le faire en Caml! Maintenant que nous avons scanf, je devrais revenir d'interruption et me remettre à implémenter la RFC(2)822. Mais n'attendez pas une distribution rapide: si vous n'avez pas besoin d'un analyseur très précis le plus simple est d'en écrire une approximation (fausse mais triviale) à l'aide d'un lexeur... Il y a sans doute un tel programme dans le filtre spamoracle de Xavier... Cordialement, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners