From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4FAA7BC48 for ; Mon, 4 Apr 2005 05:42:06 +0200 (CEST) Received: from ensim.smartydns22.com (ensim.smartydns22.com [67.15.74.65]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j343g4BQ001062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 4 Apr 2005 05:42:05 +0200 Received: from www.ivorykite.com (localhost.localdomain [127.0.0.1]) by ensim.smartydns22.com (8.12.11/8.12.10) with SMTP id j343g3kD003551 for ; Mon, 4 Apr 2005 13:42:03 +1000 Received: from 202.164.198.46 (SquirrelMail authenticated user effbiae@ivorykite.com) by www.ivorykite.com with HTTP; Mon, 4 Apr 2005 13:42:03 +1000 (EST) Message-ID: <51945.202.164.198.46.1112586123.squirrel@www.ivorykite.com> In-Reply-To: <50130.202.164.198.46.1112418605.squirrel@www.ivorykite.com> References: <49464.202.164.198.46.1112355123.squirrel@www.ivorykite.com> <424DA923.7020106@tfb.com> <50130.202.164.198.46.1112418605.squirrel@www.ivorykite.com> Date: Mon, 4 Apr 2005 13:42:03 +1000 (EST) Subject: Re: some comments on ocaml{lex,yacc} from a novice's POV From: "Jack Andrews" To: caml-list@yquem.inria.fr Reply-To: effbiae@ivorykite.com User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Miltered: at nez-perce with ID 4250B78C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 parsing:01 uchicago:01 tokens:01 grammar:01 parser:01 umontreal:01 lalr:01 lalr:01 parser:01 ocaml:01 compilers:01 define:01 lisp:01 macros:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Jack Andrews said: > have used ply (python lex-yacc) most recently for parsing and believe it > to be one of the more elegant mechanisms i've seen. > http://systems.cs.uchicago.edu/ply/ply.html > > elegant because there are no lex and yacc input files, but rather the > tokens and grammar rules are defined in python code -- succinctly! i've now found the most elegant parser generator i have seen (scheme): http://www.iro.umontreal.ca/~boucherd/Lalr/documentation/lalr.html here's the usual calc example that generates a parser: (define expr-parser (lalr-parser ; Terminal symbols (ID + - * /) ; Productions (e (e + t) : (+ $1 $3) (e - t) : (- $1 $3) (t) : $1) (t (t * f) : (* $1 $3) (t / f) : (/ $1 $3) (f) : $1) (f (ID) : $1))) isn't that nice?!? this is an example of the power of lisp macros that paul graham talks about. compare with caml solutions? compare with any other solution? i'm genuinely trying to choose my next language. i was drawn to ocaml because it's a fast, functional language: i want that power without having to optimize to C. i'm told there are good scheme compilers. i was drawn to ocaml because of it's score in the "language shootout"(s) and because of it's high placing in the programming contest. so this post is a troll, i guess, but i want to make an informed choice. tia, jack