From dev-return-86990-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Tue May 29 12:27:12 2012 Return-Path: X-Original-To: apmail-ant-dev-archive@www.apache.org Delivered-To: apmail-ant-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93267C4C9 for ; Tue, 29 May 2012 12:27:12 +0000 (UTC) Received: (qmail 19382 invoked by uid 500); 29 May 2012 12:27:12 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 18951 invoked by uid 500); 29 May 2012 12:27:07 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 18902 invoked by uid 99); 29 May 2012 12:27:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 12:27:05 +0000 X-ASF-Spam-Status: No, hits=1.0 required=5.0 tests=SPF_HELO_PASS,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of nicolas.lalevee@hibnet.org does not designate 216.86.168.183 as permitted sender) Received: from [216.86.168.183] (HELO mxout-08.mxes.net) (216.86.168.183) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 12:26:59 +0000 Received: from [10.0.0.209] (unknown [92.103.90.130]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 80E4A50A6C for ; Tue, 29 May 2012 08:26:37 -0400 (EDT) From: =?iso-8859-1?Q?Nicolas_Lalev=E9e?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: A DSL for Ant Date: Tue, 29 May 2012 14:26:35 +0200 Message-Id: <0494E690-DDCC-4827-8337-090039D42F77@hibnet.org> To: Ant Developers List Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-Virus-Checked: Checked by ClamAV on apache.org Hi, I was always been amazed by the features of the Xtext Eclipse plugin = [1], so I played a little bit with it and tried to make a DSL for Ant. = And by DSL, I mean a real domain specific language which is not a work = around existing language like groovy front [2]. Now that I have been = able to make it work properly and I am quite happy of the result, I'm = sharing it with you [3]. See the doc [4] for a screenshot of the plugin and an simple example of = what a build.ant would look like. The grammar definition is to be found = there [5]. Far from everything as been implemented. But it is a nice proof of = concept I think. You may noticed I have introduce a if-then-else structure. I quite tired = of doing workaround in build.xml files :) I tried to make macrodef look like a function definition, I am not sure = it look nice. I also tried to make the property task look like usual assignment. Maybe = we could also do references by adding a keyword in front, like: ref = myref =3D "foo" Let me know what you think of the grammar ! For those of you who look closely to the code, you should find two = parsers. The first one is the one generated by Xtext. But for the little = experiment I have done, I found it very slow to boot, more than 1s on my = icore7, just the load the parser without having parsed anything (there = is some guice and ecore involved). Since the Xtext grammar is very very = close to the Antlr one (it is actually based on Antlr), I rewrote the = AntDSL.xtext [5] into an AntDSL.g [6]. And it is just as fast as anyone = would expect, just the time to load some classes. As having a generated Eclipse plugin is so awesome, and an AntDSL.g not = that hard to duplicate, I think I would make sense to have both. Nicolas [1] http://www.eclipse.org/Xtext/ [2] https://svn.apache.org/repos/asf/ant/sandbox/groovyfront [3] https://svn.apache.org/repos/asf/ant/sandbox/antdsl [4] https://svn.apache.org/repos/asf/ant/sandbox/antdsl/doc/index.html [5] = https://svn.apache.org/repos/asf/ant/sandbox/antdsl/org.apache.ant.antdsl/= src/org/apache/ant/antdsl/xtext/AntDSL.xtext [6] = https://svn.apache.org/repos/asf/ant/sandbox/antdsl/org.apache.ant.antdsl/= src/org/apache/ant/antdsl/AntDSL.g --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org