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: Sun, 01 Jan 2017 13:32:36 +0100 [thread overview]
Message-ID: <87ful3arkr.fsf@gnu.org> (raw)
In-Reply-To: <57B2C5AB-DDE6-4B0E-9D9F-A45C6B34ED51@gmail.com> (Matt Wette's message of "Sat, 31 Dec 2016 16:04:24 -0800")
Matt Wette writes:
Hi Matt!
>> Also, it seems like it doesn't like it if an #includ'ed file is meant to
>> go inside a function, like (simplified example)
> So this is a bug. And I am not sure how to proceed yet. The parser
> was designed to return a AST with code from includes under a subtree.
> This allows a file to be processed with respect to code only in that
> file. The way it works is to parse the included file as a new parse.
> That only works at the top level. This breaks for files included
> inside functions etc.
That makes sense.
> How are you processing the file? Do you want to be able to
> discriminate between a file and the included files, and only if
> included files are at the decl level (e.g., #include <stdio.h>) but
> code inside functions gets included as is (i.e., the AST looks as if
> the code was in the parent file)?
For a user, best is to have error messages that point to the file+line
where the actual code is; so in each case the included file. Gcc's cpp
always adds # <line> "<file>" markers; it makes no difference where the
file is included.
What I am currently doing, is generate lists of symbol declarations and
definitions by snarfing the original mes.c file. The declarations are
included at toplevel, which is fine. The definitions go inside
functions.
So for my specific use case it does not really much either way, although
having correct file:line:message error messages is nice. ;-)
> This will take some sort of parser-lexer hook I think. I want to
> think about a clean architecture for all the use cases.
Sure.
Greetings,
Jan
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.nl
next prev parent reply other threads:[~2017-01-01 12:32 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
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 [this message]
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=87ful3arkr.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).