caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <pierre.weis@inria.fr>
To: vincent@leleu.info
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Query: email parser in ocamllex/ocamlyacc
Date: Tue, 22 Oct 2002 23:16:19 +0200 (MET DST)	[thread overview]
Message-ID: <200210222116.XAA05792@pauillac.inria.fr> (raw)
In-Reply-To: <001a01c279d7$2555e170$c80a0ac3@amelia> from Vincent Leleu at "Oct 22, 102 03:27:20 pm"

> Version Francaise a la fin
> ------------------------------
> 
> Hello,
> 
> I'm writting an ocamllex/ocamlyacc based application that extracts a <string
> 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 <string
> 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


  reply	other threads:[~2002-10-22 21:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-22 14:27 Vincent Leleu
2002-10-22 21:16 ` Pierre Weis [this message]
2002-10-22 22:31   ` Gerd Stolpmann
2002-10-22 22:43     ` Stefano Zacchiroli
2002-10-22 23:29       ` Gerd Stolpmann
2002-10-23  7:32         ` Stefano Zacchiroli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200210222116.XAA05792@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=vincent@leleu.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).