Re: Compiling expressions

"James Harris \(es\)" <james.harris.1@gmail.com>
Thu, 7 Mar 2013 11:11:59 -0000

          From comp.compilers

Related articles
[6 earlier articles]
Re: Compiling expressions torbenm@diku.dk (2013-01-03)
Re: Compiling expressions james.harris.1@gmail.com (James Harris) (2013-01-03)
Re: Compiling expressions james.harris.1@gmail.com (James Harris) (2013-01-03)
Re: Compiling expressions mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2013-01-04)
Re: Compiling expressions james.harris.1@gmail.com (James Harris) (2013-01-06)
Re: Compiling expressions vonbrand@inf.utfsm.cl (Horst von Brand) (2013-01-14)
Re: Compiling expressions james.harris.1@gmail.com (James Harris \(es\)) (2013-03-07)
| List of all articles for this month |
From: "James Harris \(es\)" <james.harris.1@gmail.com>
Newsgroups: comp.compilers
Date: Thu, 7 Mar 2013 11:11:59 -0000
Organization: A noiseless patient Spider
References: 12-12-035 13-01-013
Keywords: parse
Posted-Date: 07 Mar 2013 21:53:31 EST

"James Harris" <james.harris.1@gmail.com> wrote in message
> On Dec 29 2012, 1:11 pm, James Harris <james.harri...@gmail.com> wrote:
> ...
>
>> 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).
>>
>> Infix and postfix operators use distinct symbols.
>
> ...
>
> Here is an idea for an expression parser to try to address the points
> mentioned. I am not sure if it covers all the bases yet.


<snipped>


In case anyone is later looking for some code to parse expressions I should
say that I have placed an updated copy at


    https://groups.google.com/group/comp.lang.misc/browse_frm/thread/c21bf4f4cd55f345


The most important changes were to allow for low-precedence postfix
operators (the original code here only allowed them to be highest
precedence) and add some detailed documentation.


James


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.