unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: 康桥 <usakq12345@gmail.com>
To: guile-user@gnu.org
Subject: Anyone who had read the src of lalr-scm?
Date: Fri, 06 Dec 2013 18:30:16 +0800	[thread overview]
Message-ID: <39x8o2nv9t0tyr0uxk3x44r0.1386325408787@email.android.com> (raw)

Hi all. I am a college student, recently I became interested in parser generating algorithms.
One of them is LALR(1).I took lalr-scm(which is mentioned in Guile Manual) as an example of the design of this kind of parser generators and studied its source code.
However, I found the source code too little scheme.It seems that it was written by a programmer who had been familier with C or Pascal before, mainly because it relies heaviliy on side-effects, which we don't use much in functional programming languages.
In spite of this, I read it almost all.I have found the part of computing itemsets, FOLLOW sets, etc.But I still leave one function not understand. It's function digraph in the macro lalr-parser in file lalr.scm.
It seems that this function is trying to traverse a digraph and make each FOLLOW set corresponding a vertex in the digraph the union of it and the FOLLOW sets corrsponding the vertices which can be reached from the vectex I mentioned before.But I can't figure out what algorithm it uses.

Anyone who know this algorithm?
BTW, should we rewrite lalr-scm in a more scheme way(even to make the process of parser generating slower)?

             reply	other threads:[~2013-12-06 10:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 10:30 康桥 [this message]
2014-09-02  6:07 ` Anyone who had read the src of lalr-scm? Thien-Thi Nguyen

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=39x8o2nv9t0tyr0uxk3x44r0.1386325408787@email.android.com \
    --to=usakq12345@gmail.com \
    --cc=guile-user@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).