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


Groups > comp.lang.c > #140828

Re: Propagating results from callbacks?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Propagating results from callbacks?
Date 2019-02-10 15:21 +0000
Organization A noiseless patient Spider
Message-ID <87lg2nacuy.fsf@bsb.me.uk> (permalink)
References <dd8bdeab-a219-4d69-83b7-60fc3615bd6d@googlegroups.com> <50b048a9-55fc-409a-9f5c-ee99d57a2e95@googlegroups.com> <37efd8e3-0b08-47d7-a3b2-e804242a63bb@googlegroups.com>

Show all headers | View raw


luser droog <luser.droog@gmail.com> writes:
<snip>
> I still wouldn't mind other points of view. This seems like
> a pale victory so far. It isn't clear to me how to scale it.

I wasn't able to comment because I was not sure what you were trying to
do.  And I still don't know how this should scale.  Are you trying to
implement parsing combinators in general, or is the goal to write a
parsing framework and you started looking at combinators as just one
possible technique?

> I've looked at bit at Tree Meta for inspiration. In Tree Meta
> all tokens when parsed are pushed onto a stack. Then the 
> larger grammatical parts pop the parts they need, build a
> tree node and push the node.

That sounds like the classic shift/reduce parsing algorithm with not
much in common with the combinator technique.  Is Tree Meta the old
(1960s) TREE-META compiler-compiler?

> Or I could somehow collect the results and add it to my result
> struct. This also seems to need some kind of annotations to 
> indicate which parser nodes are tokens and which are larger
> grammatical constructs which should become nodes of the AST.

Combinator parsers are usually lazy.  That's how you get the
backtracking.  I've not studied your C code, but in general you'll
probably either need some sort of list result, or better yet, a "thunk"
implemented in C.

(Sorry that this is all so vague, but it's a big topic and I don't know
where you want to go with it.)

-- 
Ben.

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


Thread

Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-08 16:32 -0800
  Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-08 17:08 -0800
    Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-09 20:01 -0800
      Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-10 15:21 +0000
        Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-10 12:59 -0800
          Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-10 13:49 -0800
            Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-10 14:14 -0800
              Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-12 00:31 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-12 00:45 -0800
                Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-12 14:30 -0800
                Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-12 23:56 +0000
                Re: Propagating results from callbacks? Reinhardt Behm <rbehm@hushmail.com> - 2019-02-13 12:54 +0800
                Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-13 11:16 +0000
                Re: Propagating results from callbacks? Andrew Smallshaw <andrews@sdf.org> - 2019-02-13 15:41 +0000
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 03:02 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 03:30 -0800
                Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-13 11:48 +0000
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 03:59 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 04:10 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 04:29 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 04:40 -0800
                Re: Propagating results from callbacks? Bart <bc@freeuk.com> - 2019-02-13 12:08 +0000
                Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-13 14:40 +0000
                Re: Propagating results from callbacks? Bart <bc@freeuk.com> - 2019-02-13 14:54 +0000
                Re: Propagating results from callbacks? David Brown <david.brown@hesbynett.no> - 2019-02-13 16:12 +0100
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 10:00 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 10:49 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 11:08 -0800
                Re: Propagating results from callbacks? Bart <bc@freeuk.com> - 2019-02-13 19:10 +0000
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 12:31 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 13:24 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 12:40 -0800
                Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-13 13:06 -0800
                Re: Propagating results from callbacks? David Brown <david.brown@hesbynett.no> - 2019-02-13 20:33 +0100
                Re: Propagating results from callbacks? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-02-13 15:49 +0000
          Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-12 15:19 -0800
            Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-12 19:02 -0800
              Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-13 11:26 -0800
                Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-13 16:09 -0800
                Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-14 15:41 -0800
                Re: Propagating results from callbacks? luser droog <luser.droog@gmail.com> - 2019-02-14 16:42 -0800
  Re: Propagating results from callbacks? fir <profesor.fir@gmail.com> - 2019-02-10 05:14 -0800

csiph-web