Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: James Harris Newsgroups: comp.compilers Subject: Re: Compiling expressions Date: Wed, 2 Jan 2013 09:10:32 -0800 (PST) Organization: Compilers Central Lines: 37 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <13-01-007@comp.compilers> References: <12-12-035@comp.compilers> <12-12-038@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: leila.iecc.com 1357243896 98676 64.57.183.58 (3 Jan 2013 20:11:36 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 3 Jan 2013 20:11:36 +0000 (UTC) Keywords: parse Posted-Date: 03 Jan 2013 15:11:36 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:830 On Dec 30 2012, 7:58 am, "Dmitry A. Kazakov" wrote: > On Sat, 29 Dec 2012 05:11:16 -0800 (PST), James Harris wrote: > > Compiling expressions ... ... > > requirements are: > > > 1. Hand-written, not the output of a parser generator. > > 2. Efficient and without backtracking. > > 3. Precedences (and possibly associativities) defined in tables. > > 4. Output to be a tree structure. > > 5. Parenthesised subexpressions allowed. > > 6. Some operator families are *not* to associate with each other. See > > below. > > 7. Monadic prefix, dyadic infix and monadic postfix operators are all > > allowed. > > 8. Prefix and infix operators can use some same symbols (e.g. minus > > sign). > > Here is an implementation with an explanation of the technique used: > > http://www.dmitry-kazakov.de/ada/components.htm#Parsers_etc > > I extended the method, which fairly old, towards non-associativity (#6), > advanced parenthesis (#5, keyed parameter associations), and split > association priorities into left-right pairs. But basically it is still the > same twin-stack method. Everything is table-driven, of course. Thanks, a took a look. As mentioned I'm not looking for a solution as yet but I'll keep a note of it for guidance if nothing else. If it covers all the points I was asking about it's impressive. James