Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] otags problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hendrik Tews <tews@t...>
Subject: [Caml-list] camlp4o problem (was: otags problem)
Hi,

Shivkumar Chandrasekaran writes:
   Date: Fri, 1 Feb 2002 16:12:56 -0800
   Subject: [Caml-list] otags problem
   
   In my program I have an operator named ( <:> ). Unfortunately otags 
   3.04.3 reports a lexing error  (character '<' expected) on that line. 
   ocaml 3.04 itself has no problem with it. Can anybody help me work 
   around it? 
   
The problem is that otags uses camlp4o to parse the ocaml sources.
Sometimes camlp4o is different from ocaml. You just hit one of
these cases: 

    ithif51 ocaml 15> ledit ocaml
	    Objective Caml version 3.04

    # let ( <:> ) x y = x + y;;
    val ( <:> ) : int -> int -> int = <fun>
    # #load "camlp4o.cma";;
	    Camlp4 Parsing version 3.04

    # let ( <:> ) x y = x + y;;
    Toplevel input:
    # let ( <:> ) x y = x + y;;
	      ^
    Lexing error: character '<' expected

This difference seems to be a feature: in camlp4 "<:" starts a
quotation. The only solutions that I see are the following:

- use an infix operator that works in ocaml and in camlp4
- rewrite otags ;-)

For Daniel de Rauglaudre: Because normal ocaml users are now
sometimes requested to use camlp4o for parsing (for instance for
streams) I think it makes sense to provide a camlp4 parser that
is _exacly_ ocaml. Maybe by placing the quotation syntax in a
separate file, say pa_q.cmo?


Bye,

Hendrik
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr