unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: Matt Wette <matt.wette@gmail.com>
Cc: Guile User <guile-user@gnu.org>
Subject: Unexpected extra parens on struct-ref [WAS: [ANN] nyacc 0.80.3 released]
Date: Mon, 24 Jul 2017 14:49:18 +0200	[thread overview]
Message-ID: <87h8y2gfu9.fsf@gnu.org> (raw)
In-Reply-To: <2D72B3FB-6075-4F56-8698-6AC5BA96B2C0@gmail.com> (Matt Wette's message of "Sun, 18 Jun 2017 15:07:58 -0700")

Matt Wette writes:

> NYACC V0.80.3 is released.

This works as expected:

    typedef struct foo {
      int bar;
    } baz;

    int
    main ()
    {
      struct foo f;

      return 0;
    }

=>

    (trans-unit
      (decl (decl-spec-list
              (stor-spec (typedef))
              (type-spec
                (struct-def
                  (ident "foo")
                  (field-list
                    (comp-decl
                      (decl-spec-list (type-spec (fixed-type "int")))
                      (comp-declr-list (comp-declr (ident "bar"))))))))
            (init-declr-list (init-declr (ident "baz"))))
      (fctn-defn
        (decl-spec-list (type-spec (fixed-type "int")))
        (ftn-declr (ident "main") (param-list))
        (compd-stmt
          (block-item-list
            (decl (decl-spec-list
                    (type-spec (struct-ref (ident "foo"))))
                  (init-declr-list (init-declr (ident "f"))))
            (return (p-expr (fixed "0")))))))


but typedef'ing struct foo to foo like so:

    typedef struct foo {
      int bar;
    } foo;

    int
    main ()
    {
      struct foo f;

      return 0;
    }

gives unexpected parens when using it in main:

    (trans-unit
      (decl (decl-spec-list
              (stor-spec (typedef))
              (type-spec
                (struct-def
                  (ident "foo")
                  (field-list
                    (comp-decl
                      (decl-spec-list (type-spec (fixed-type "int")))
                      (comp-declr-list (comp-declr (ident "bar"))))))))
            (init-declr-list (init-declr (ident "foo"))))
      (fctn-defn
        (decl-spec-list (type-spec (fixed-type "int")))
        (ftn-declr (ident "main") (param-list))
        (compd-stmt
          (block-item-list
            (decl (decl-spec-list
                    (type-spec (struct-ref (ident ("foo")))))
                  (init-declr-list (init-declr (ident "f"))))
            (return (p-expr (fixed "0")))))))


This bit: (struct-ref (ident ("foo")))

There seem to be more places where the extra parens occur.

Greetings,
janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com



  parent reply	other threads:[~2017-07-24 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 22:07 [ANN] nyacc 0.80.3 released Matt Wette
2017-07-24 12:35 ` 0ULL [WAS: [ANN] nyacc 0.80.3 released] Jan Nieuwenhuizen
2017-07-24 12:49 ` Jan Nieuwenhuizen [this message]
2017-07-24 12:52 ` Jan Nieuwenhuizen
2017-07-24 12:59 ` libguile/eval.c: parse failed on input "x37" " Jan Nieuwenhuizen

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=87h8y2gfu9.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=matt.wette@gmail.com \
    /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).