From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15182 invoked by alias); 11 May 2006 16:45:26 -0000 Received: (qmail 15169 invoked by uid 22791); 11 May 2006 16:45:25 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0102.google.com (HELO wx-out-0102.google.com) (66.249.82.197) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 11 May 2006 16:45:23 +0000 Received: by wx-out-0102.google.com with SMTP id i28so25723wxd for ; Thu, 11 May 2006 09:45:19 -0700 (PDT) Received: by 10.70.46.14 with SMTP id t14mr1375857wxt; Thu, 11 May 2006 09:45:19 -0700 (PDT) Received: by 10.70.126.17 with HTTP; Thu, 11 May 2006 09:45:19 -0700 (PDT) Message-ID: <8f2776cb0605110945i75d9402bp6743ae22da38d0cb@mail.gmail.com> Date: Thu, 11 May 2006 16:45:00 -0000 From: "Jim Blandy" To: "Dave Brolley" Subject: Re: [patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level of the Input Cc: ttn@glug.org, cgen@sources.redhat.com In-Reply-To: <44634659.60508@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <44622986.3090309@redhat.com> <17506.11439.818364.259602@casey.transmeta.com> <44634659.60508@redhat.com> X-Google-Sender-Auth: 7f95d4c9cdb5c22a X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2006-q2/txt/msg00029.txt.bz2 On 5/11/06, Dave Brolley wrote: > Thien-Thi Nguyen wrote: > > >why not allow computed `include' instead? (perhaps that is already > >supported?) something like: > > > >(include EXPR) > > > >then EXPR can be all manner of `if', `cond' or whatever. e.g.: > > > >(include (if (application-is? SID-SIMULATOR) > > "sid-macros.cpu" > > "sim-macros.cpu")) > > > >(include (cond ((application-is? SID-SIMULATOR) > > "sid-macros.cpu") > > (else "sim-macros.cpu"))) > > > >(include (case (application->symbol APPLICATION-OBJECT) > > ((SIMULATOR) "sid-macros.cpu") > > (else "sid-macros.cpu"))) > > > > > > > The point isn't really the (include "..."). That's just what I happened > to use the 'if' capability for. The true and false expressions could > theoretically be any valid top level CGEN construct. Implementing > conditional capability for them all seems like a lot more work for no > gain and may not even make sense in some cases. Also 'cond' or 'case' > could easily be added as top level tests if necessary. The larger question is, why aren't CGEN machine description files just arbitrary Scheme code that happens to call some functions to register machine description pieces? Then you'd have the full Scheme language at your disposal, not just pmacros. None of this would complicate the interesting parts of CGEN --- the code for producing encoders, decoders, and simulators. They would operate on the same data structures they do now. You'd just have a lot more flexibility in how those structures are produced.