Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #866

Re: Compiling expressions

From "James Harris \(es\)" <james.harris.1@gmail.com>
Newsgroups comp.compilers
Subject Re: Compiling expressions
Date 2013-03-07 11:11 +0000
Organization A noiseless patient Spider
Message-ID <13-03-005@comp.compilers> (permalink)
References <12-12-035@comp.compilers> <13-01-013@comp.compilers>

Show all headers | View raw


"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

Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Compiling expressions James Harris <james.harris.1@gmail.com> - 2012-12-29 05:11 -0800
  Re: Compiling expressions glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-29 23:33 +0000
    Re: Compiling expressions James Harris <james.harris.1@gmail.com> - 2013-01-02 09:04 -0800
      Re: Compiling expressions "matzebraun@googlemail.com" <matzebraun@googlemail.com> - 2013-01-03 07:13 -0800
      Re: Compiling expressions Horst von Brand <vonbrand@inf.utfsm.cl> - 2013-01-14 16:31 -0300
  Re: Compiling expressions "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-12-30 08:58 +0100
    Re: Compiling expressions James Harris <james.harris.1@gmail.com> - 2013-01-02 09:10 -0800
    Re: Compiling expressions James Harris <james.harris.1@gmail.com> - 2013-01-03 12:01 -0800
      Re: Compiling expressions "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2013-01-04 10:18 +0100
  Re: Compiling expressions torbenm@diku.dk (Torben Ægidius Mogensen) - 2013-01-03 16:49 +0100
  Re: Compiling expressions James Harris <james.harris.1@gmail.com> - 2013-01-03 13:33 -0800
    Re: Compiling expressions James Harris <james.harris.1@gmail.com> - 2013-01-06 00:57 -0800
    Re: Compiling expressions "James Harris \(es\)" <james.harris.1@gmail.com> - 2013-03-07 11:11 +0000

csiph-web