caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Syntax vs Operators
@ 2005-08-22 15:55 Jacques Carette
  2005-08-23 10:16 ` [Caml-list] " Damien Doligez
  0 siblings, 1 reply; 4+ messages in thread
From: Jacques Carette @ 2005-08-22 15:55 UTC (permalink / raw)
  To: caml-list

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?

The goal is to understand which constructs can be re-defined (locally) 
in a module.  The eventual application is a more genial syntax for a DSL 
implemented via MetaOCaml (and more functors than anyone in their right 
mind would really want to use...).

Jacques


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Syntax vs Operators
  2005-08-22 15:55 Syntax vs Operators Jacques Carette
@ 2005-08-23 10:16 ` Damien Doligez
  2005-08-23 18:05   ` Jacques Carette
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Doligez @ 2005-08-23 10:16 UTC (permalink / raw)
  To: Jacques Carette; +Cc: caml-list

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.

-- Damien


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Syntax vs Operators
  2005-08-23 10:16 ` [Caml-list] " Damien Doligez
@ 2005-08-23 18:05   ` Jacques Carette
  2005-08-23 19:42     ` Damien Doligez
  0 siblings, 1 reply; 4+ messages in thread
From: Jacques Carette @ 2005-08-23 18:05 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Syntax vs Operators
  2005-08-23 18:05   ` Jacques Carette
@ 2005-08-23 19:42     ` Damien Doligez
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Doligez @ 2005-08-23 19:42 UTC (permalink / raw)
  To: caml users

On Aug 23, 2005, at 20:05, Jacques Carette wrote:

> 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.

Maybe I'm overlooking something, but I think the ones in the  
"keywords" list
are the ones that you cannot or should not override.

> 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.

If it's a DSL that includes OCaml as a sublanguage, I think at some  
point you
will have users who want to use the OCaml features that you are hiding.

-- Damien


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-23 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 15:55 Syntax vs Operators Jacques Carette
2005-08-23 10:16 ` [Caml-list] " Damien Doligez
2005-08-23 18:05   ` Jacques Carette
2005-08-23 19:42     ` Damien Doligez

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).