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@gnu.org
Subject: Re: nyacc 0.73.0 released
Date: Sat, 31 Dec 2016 15:15:47 +0100	[thread overview]
Message-ID: <87r34ob2wc.fsf@gnu.org> (raw)
In-Reply-To: <F0A1A558-028A-4CBC-98B4-B35891F3D333@gmail.com> (Matt Wette's message of "Mon, 26 Dec 2016 06:53:32 -0800")

Matt Wette writes:

> I believe C99 parser is complete.  There may be errors, but I think
> all the elements are there.

Great!  As it turns out, I was using some GNU extensions (anonymous
unions inside structs.

I have now picked-up my work on Mes's simple C compiler backend, using
Nyacc.  I have already replaced my LALR parser with Nyacc's AST[0].

How far is the Nyacc's C99 preprocessor?  I have two problems with it.

It would be very helpful if it would disregard anything inside a false
conditional directive.  It seems I cannot conditionally comment things
out that Nyacc does not parse, like

--8<---------------cut here---------------start------------->8---
    #if __GNUC__
    void
    _start ()
    {
      puts ("Hello micro-mes!\n");

      ///int r = main (0,0);
      int r;
      asm (
           "push $0\n\t"
           "push $0\n\t"
           "call main\n\t"
           "movl %%eax,%0\n\t"
           : "=r" (r)
           : //no inputs "" (&main)
           );
    #endif // GNUC
--8<---------------cut here---------------end--------------->8---

==>  micro-mes.c:199: parse failed at state 379, on input ":"

or like GCC headers that Nyacc does not parse, like <assert.h>, which is
a bit of a pain.

Also, it seems like it doesn't like it if an #includ'ed file is meant to
go inside a function, like (simplified example)

--8<---------------cut here---------------start------------->8---
    // main.i
    r = 3;
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
    // main.c
    int
    main ()
    {
      int r;
      #include "main.i"
      return r;
    } 
--8<---------------cut here---------------end--------------->8---


==> ./main.i:2: parse failed at state 43, on input "r"

Greetings,
Jan

[0] https://gitlab.com/janneke/mes/tree/wip-mescc

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



  reply	other threads:[~2016-12-31 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26  4:05 nyacc 0.73.0 released Matt Wette
2016-12-26  7:29 ` Jan Nieuwenhuizen
2016-12-26 14:53   ` Matt Wette
2016-12-31 14:15     ` Jan Nieuwenhuizen [this message]
2016-12-31 15:57       ` Matt Wette
2016-12-31 16:08         ` Matt Wette
2017-01-01 12:22           ` Jan Nieuwenhuizen
2017-01-01  0:04       ` Matt Wette
2017-01-01 12:32         ` Jan Nieuwenhuizen
2017-01-07 11:14 ` Jan Nieuwenhuizen
2017-01-07 14:19   ` Matt Wette
2017-01-07 20:02     ` Jan Nieuwenhuizen
2017-01-11  2:33 ` Chaos Eternal
2017-01-11  2:58   ` Matt Wette

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=87r34ob2wc.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).