From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 26 11:10:39 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B298816A4CE for ; Tue, 26 Apr 2005 11:10:39 +0000 (GMT) Received: from dirg.bris.ac.uk (dirg.bris.ac.uk [137.222.10.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4312F43D45 for ; Tue, 26 Apr 2005 11:10:39 +0000 (GMT) (envelope-from Jan.Grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk ([137.222.16.62]) by dirg.bris.ac.uk with esmtp (Exim 4.50) id 1DQNxX-0006JH-Ng; Tue, 26 Apr 2005 12:10:34 +0100 Received: from cmjg (helo=localhost) by mail.ilrt.bris.ac.uk with local-esmtp (Exim 4.50) id 1DQNxW-0004BD-W4; Tue, 26 Apr 2005 12:10:31 +0100 Date: Tue, 26 Apr 2005 12:10:30 +0100 (BST) From: Jan Grant X-X-Sender: cmjg@mail.ilrt.bris.ac.uk To: Divacky Roman In-Reply-To: <20050425175635.GA7617@stud.fit.vutbr.cz> Message-ID: References: <20050425055016.56609.qmail@web41303.mail.yahoo.com> <20050425175635.GA7617@stud.fit.vutbr.cz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Jan Grant X-Spam-Score: -2.8 X-Spam-Level: -- cc: freebsd-hackers@freebsd.org cc: Ron Chen Subject: Re: C-style expression processing... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 11:10:39 -0000 On Mon, 25 Apr 2005, Divacky Roman wrote: > On Sun, Apr 24, 2005 at 10:50:16PM -0700, Ron Chen wrote: > > Hi, > > > > I am trying to add a new feature in Gridengine > > (free/opensource) to support ex-LSF users - there are > > more and more LSF users migrating to Gridengine), and > > some requested this one: > > > > In LSF, a user can specify from the command line the > > resource requirements of a batch job: > > > > (mem >= 100 || pg < 200.0) > > > > Where mem and pg are variables (they changes in time, > > and the master cluster scheduler has the most > > up-to-date information). And what I need is to find > > out whether the expression is true or not. > > > > My question is, is there an expression processing > > library that can handle complex equations easily? > > you can easily parse it, using yacc/lex... and even hand-writing such parser > cannot be difficult.. Google for: yacc calculator example. Rather than doing AST creation or semantic analysis, many introductions to yacc show it being used to create simple calculators. You'll probably even find one on your system: /usr/share/doc/psd/15.yacc/paper.ascii.gz That probably ought to sort you out. -- jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/ Tel +44 (0)117 9287088 (with luck) http://ioctl.org/jan/ Q: What's yellow and equivalent to the axiom of choice? A: Zorn's lemon.