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
Typesystem and Parsers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-10-22 (17:41)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Typesystem and Parsers
Zitat von "Oliver Bandel" <oliver@first.in-berlin.de>:

> Hello,
> when reading papers or books on parsing
> techniques, the parsing often is done in
> different distinctive steps, where type checking
> and semantic checks are done after the parse tree
> is build up.
> This may be the classical way, for example when doing it in C.
> When using OCaml with it's strong type system,
> IMHO the big advantage is, that the type system can be used to  
> restrict the input data in a way that without additionally checks  
> correct input is enforced, otherwise a parse error is detected.

Would something like a parse-error-token make sense, when
the typesystem and the ocamlyacc-grammar forbidds parsing
wrong sequences?

Maybe something like (simple example):

type token_t =
   | Sub
   | Int of int
   | String of string
   | ParseError of string