Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 =
     Add
   | Sub
   | Int of int
   | String of string
   | ParseError of string

??


Ciao,
    Oliver