caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] camlp4 vs. ocamllex/yacc?
@ 2003-01-24 14:15 Daniel Andor
  2003-01-24 14:32 ` Jacques Carette
  2003-01-24 15:12 ` Jean-Christophe Filliatre
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Andor @ 2003-01-24 14:15 UTC (permalink / raw)
  To: caml-list

Hi,

I want to write a smallish translator that would read mathematical formulae in 
an easy to read (for humans, that is) format and translate them to a computer 
language (ocaml, fortran, c, latex, etc) for output.  In the process it could 
do simple consistency checks (like making sure the dimensionality of physical 
equations are correct, for example) on the parse tree. 

What are the advantages/disadvantages of using camlp4 vs. a combination of 
ocamllex and ocamlyacc?  

Is there already a translator like this out there (to save me the effort)?  

Any tips on how consistency checks on the equations could be made harnessing 
the power of the type system?

Thanks,
Daniel.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* RE: [Caml-list] camlp4 vs. ocamllex/yacc?
  2003-01-24 14:15 [Caml-list] camlp4 vs. ocamllex/yacc? Daniel Andor
@ 2003-01-24 14:32 ` Jacques Carette
  2003-01-24 15:12 ` Jean-Christophe Filliatre
  1 sibling, 0 replies; 5+ messages in thread
From: Jacques Carette @ 2003-01-24 14:32 UTC (permalink / raw)
  To: caml-list; +Cc: Daniel.Andor

I am unsure if this solution satisfies all of your requirements, but all of
the functionality you mention below is already available in Maple, both
interactively and in batch.  And for a much larger set of functions than
you'd likely ever have the patience to work with...  And the Units package
(as of Maple 7) includes more units/dimensions than any sane human being
would ever care to know about [the author of that package was, umm,
thorough, right, that's it :-) ].

If nothing else, you should at least use Maple to test any eventual
implementation you find.

Jacques

PS: disclaimer - I used to be affiliated with Maple, but no longer am.
PPS: even the set of 'usual' units forms a rather nasty poset, much more
complicated than one would imagine.  Consistency checking is fully
decidable, but an interesting exercise nevertheless.

-----Original Message-----
From: owner-caml-list@pauillac.inria.fr
[mailto:owner-caml-list@pauillac.inria.fr]On Behalf Of Daniel Andor
Sent: Friday, January 24, 2003 9:16 AM
To: caml-list@inria.fr
Subject: [Caml-list] camlp4 vs. ocamllex/yacc?


Hi,

I want to write a smallish translator that would read mathematical formulae
in
an easy to read (for humans, that is) format and translate them to a
computer
language (ocaml, fortran, c, latex, etc) for output.  In the process it
could
do simple consistency checks (like making sure the dimensionality of
physical
equations are correct, for example) on the parse tree.

What are the advantages/disadvantages of using camlp4 vs. a combination of
ocamllex and ocamlyacc?

Is there already a translator like this out there (to save me the effort)?

Any tips on how consistency checks on the equations could be made harnessing
the power of the type system?

Thanks,
Daniel.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives:
http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] camlp4 vs. ocamllex/yacc?
  2003-01-24 14:15 [Caml-list] camlp4 vs. ocamllex/yacc? Daniel Andor
  2003-01-24 14:32 ` Jacques Carette
@ 2003-01-24 15:12 ` Jean-Christophe Filliatre
  2003-01-24 16:21   ` Alain.Frisch
  2003-01-26  2:50   ` Ed L Cashin
  1 sibling, 2 replies; 5+ messages in thread
From: Jean-Christophe Filliatre @ 2003-01-24 15:12 UTC (permalink / raw)
  To: Daniel.Andor; +Cc: caml-list


 > What are the advantages/disadvantages of using camlp4 vs. a combination of 
 > ocamllex and ocamlyacc?  

For  having  used both  of  them intensively,  I  see  (at least)  the
following advantages of camlp4:

 - it comes with a lexer, saving you the burden of writing one
   (this lexer conforms to ocaml lexical conventions; for prototype
   implementations, it is usually fine)

 - it offers high level grammar constructors such as LIST0, LIST1,
   OPT, ... It results in cleaner and more concise grammars.

Another advantage of camlp4, not of common use, is to propose an ocaml
datatype for grammars: thus grammars can be extended dynamically. This
is not possible with ocamlyacc grammars.

The (sole?)  advantage of  ocamlyacc is when  you already have  a YACC
grammar. Turning it into an ocamlyacc grammar is almost immediate.

 > Is there already a translator like this out there (to save me the effort)?  

There are probably many (Ocaml is, in particular, a good tool to write
compilers) but  this really  depends on your  input syntax  (there are
really *many* ways to write mathematics using ASCII :-).

-- 
Jean-Christophe

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] camlp4 vs. ocamllex/yacc?
  2003-01-24 15:12 ` Jean-Christophe Filliatre
@ 2003-01-24 16:21   ` Alain.Frisch
  2003-01-26  2:50   ` Ed L Cashin
  1 sibling, 0 replies; 5+ messages in thread
From: Alain.Frisch @ 2003-01-24 16:21 UTC (permalink / raw)
  To: Jean-Christophe Filliatre; +Cc: Daniel.Andor, Caml list

On Fri, 24 Jan 2003, Jean-Christophe Filliatre wrote:

>  > What are the advantages/disadvantages of using camlp4 vs. a combination of
>  > ocamllex and ocamlyacc?
>
> For  having  used both  of  them intensively,  I  see  (at least)  the
> following advantages of camlp4:
>
>  - it comes with a lexer, saving you the burden of writing one
>    (this lexer conforms to ocaml lexical conventions; for prototype
>    implementations, it is usually fine)
>
>  - it offers high level grammar constructors such as LIST0, LIST1,
>    OPT, ... It results in cleaner and more concise grammars.

I can add:
   - it provides automatic error messages, explaining which rule failed,
     and what was expected

and a disadvantage:
   - no detection of 'conflicts' in grammars


-- Alain
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] camlp4 vs. ocamllex/yacc?
  2003-01-24 15:12 ` Jean-Christophe Filliatre
  2003-01-24 16:21   ` Alain.Frisch
@ 2003-01-26  2:50   ` Ed L Cashin
  1 sibling, 0 replies; 5+ messages in thread
From: Ed L Cashin @ 2003-01-26  2:50 UTC (permalink / raw)
  Cc: caml-list

Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr> writes:

...
> The (sole?)  advantage of ocamlyacc is when you already have a YACC
> grammar. Turning it into an ocamlyacc grammar is almost immediate.

I am using ocamlyacc for a compilers course.  I think I'm sticking to
ocamlyacc because all the other students are using bison, but I got
curious when reading this thread.  I decided to check out camlp4, and
I found this page:

  http://caml.inria.fr/camlp4/

... where I read what could be construed as another disadvantage of
camlp4:

  Developpment stopped: no more extension, or bug fix is assured

I'm not sure what to make of it, though.  There's an old thread in the
archives where the principle camlp4 developer at the time seems to
indicate an intention to only work on a version that's separate from
the ocaml distribution.

What's the current situation?  Is there some kind of version split
going on now?  

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2003-01-27  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-24 14:15 [Caml-list] camlp4 vs. ocamllex/yacc? Daniel Andor
2003-01-24 14:32 ` Jacques Carette
2003-01-24 15:12 ` Jean-Christophe Filliatre
2003-01-24 16:21   ` Alain.Frisch
2003-01-26  2:50   ` Ed L Cashin

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