From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 91642BDCE for ; Tue, 23 Aug 2005 20:04:57 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7NI4vOO027854 for ; Tue, 23 Aug 2005 20:04:57 +0200 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 UAA17788 for ; Tue, 23 Aug 2005 20:04:55 +0200 (MET DST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7NI4scj027036; Tue, 23 Aug 2005 20:04:55 +0200 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca [130.113.68.27] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.1.8) with ESMTP id 101874105; Tue, 23 Aug 2005 14:04:54 -0400 Message-ID: <430B654F.4080908@mcmaster.ca> Date: Tue, 23 Aug 2005 14:05:03 -0400 From: Jacques Carette User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Damien Doligez Cc: caml-list@inria.fr Subject: Re: [Caml-list] Syntax vs Operators References: <4309F579.4020302@mcmaster.ca> <3C37507F-C2C9-4E75-AC82-0CF742D87A18@inria.fr> In-Reply-To: <3C37507F-C2C9-4E75-AC82-0CF742D87A18@inria.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 430B6549.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 430B6546.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 syntax:01 damien:01 ocaml:01 pervasives:01 lexer:01 infix:01 syntax:01 overriding:01 ocaml:01 functors:01 2005,:98 wrote:01 wrote:01 doligez:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Damien Doligez wrote: > On Aug 22, 2005, at 17:55, Jacques Carette wrote: > >> I have been going through the documentation, trying to figure out >> which constructs in Ocaml are syntactic (like :: seems to be) and >> cannot be oer-ridden, and others like + which are values in >> Pervasives. Is there a simple way to find out which language >> constructs are purely syntactic? > > > You should look a the lexer documentation: > < http://caml.inria.fr/pub/docs/manual-ocaml/manual009.html >, > in the section titled "Prefix and Infix Symbols", you will get the > syntax of > all the user-definable symbols. Some of them are predefined, but you > are > guaranteed to be able to override them. You should avoid overriding > the ones > that are listed as keywords (in the next section), even if some of them > are actually redefinable in the current implementations. > Actually, the whole point of this question is that I want to redefine/override them - and I wanted to find out which I could not. I know I can override + if I want, I want to know about the ones like :: which have a pre-defined meaning but can not be overridden. By carefully reading sections 9 and 15 of the manual, I have managed to extract this information - I was just hoping that there was something simpler that I had somehow overlooked. The point is to see how much of a DSL I can create in Ocaml, using Ocaml syntax, by using lots of Functors. Very much in the spirit of the Lua-ML interpreter in fact, except that I want to use Caml syntax rather than having to parse a new language. Or I may decide to adapt the camlp4 macros for the ``revised syntax'' for my purposes. Jacques