caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Andrzej M. Ostruszka" <ostruszk@order.if.uj.edu.pl>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Re: yacc & lex: Does the contructor name matter?
Date: Tue, 3 Dec 2002 11:48:52 +0100	[thread overview]
Message-ID: <20021203114852.A22797@order.if.uj.edu.pl> (raw)
In-Reply-To: <20021203110153.B7512@pauillac.inria.fr>; from xavier.leroy@inria.fr on Tue, Dec 03, 2002 at 11:01:53AM +0100

On Tue, Dec 03 (2002), Xavier Leroy wrote:
[...]

First of all thank you for an explanation

> The actual grammar that ocamlyacc compiles down to a PDA has some
> additional productions:
> 
> $accept: %entry EOF       { should not reduce }
> %entry:  '\001' line      { stop parsing with result $2 }
> line:    expr             { Some $1 }
>       | /*nothing*/       { None }

I've looked at the .ml and .mli but haven't found anything regarding EOF
so that's why I asked.

> The best way to avoid this difficulty is to make sure that all your
> grammar entry points are explicitly terminated by a token, as shown
> in the example in section 12.6 of the manual:
> 
>     %start line
> 
>     %%
>     line:
>       | expr EoL { Some $1 }
>       | /* nothing */ EoL { None }

:), I've read that section and knew the solution and just wanted to know
the cause of this behaviour.

> > - compile AST to list of functions which will take in arguments the
> >   operands and the "pointer" of the place where to store the result.
> >   I don't have now a clear idea how to do it (I still think in C :)) but
> >   the motivation is to remove pushing functions and stack management of
> >   the previous solution
> 
> I don't understand your third option.

Well I thought about having some list of records
{ double x, y; double* r; and maybe function pointer }
where the function would take x and y and store the result where
r points to and the job of the compiler would be to craft those pointers
(and x's in case of constants) appropriately.  As I've told I'm still
rather C than OCaml guy :).

						Best regards

PS. Doubling of the posts is not my fault it happens "somewhere" in
  France (one can check that by message ID).  Maybe this is because I'm
  sending from another address that I'm subscribed?
-- 
    ____   _  ___
   /  | \_/ |/ _ \		Andrzej Marek Ostruszka
  / _ |     | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow)
 /_/ L|_|V|_|\___/	(PGP <-- finger ostruszk@order.if.uj.edu.pl)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      reply	other threads:[~2002-12-03 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-02  8:55 [Caml-list] " Andrzej M. Ostruszka
2002-12-03 10:01 ` Xavier Leroy
2002-12-03 10:48   ` Andrzej M. Ostruszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021203114852.A22797@order.if.uj.edu.pl \
    --to=ostruszk@order.if.uj.edu.pl \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).