unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* NYACC: getting source location info?
@ 2020-07-10 20:37 tomas
  2020-07-11  3:00 ` Matt Wette
  0 siblings, 1 reply; 3+ messages in thread
From: tomas @ 2020-07-10 20:37 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Hi,

I'm having some fun with NYACC (thanks, Matt!).

To help debugging things and for errors and warnings, it'd be nice
to "know" where the current LHS non-terminal starts in the source.

Its endpoint is (is it?) (port-line (current-input-port) [and, of
course, (port-column ...)] -- at least some playing around suggest
that (and it makes sense, somehow).

Is there anything I've overlooked? Or do I have to hack the (or
roll-my-own) lexer for that?

Thanks for any insight

cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: NYACC: getting source location info?
  2020-07-10 20:37 NYACC: getting source location info? tomas
@ 2020-07-11  3:00 ` Matt Wette
  2020-07-11  8:10   ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Wette @ 2020-07-11  3:00 UTC (permalink / raw)
  To: guile-user



On 7/10/20 1:37 PM, tomas@tuxteam.de wrote:
> Hi,
>
> I'm having some fun with NYACC (thanks, Matt!).
>
> To help debugging things and for errors and warnings, it'd be nice
> to "know" where the current LHS non-terminal starts in the source.
>
> Its endpoint is (is it?) (port-line (current-input-port) [and, of
> course, (port-column ...)] -- at least some playing around suggest
> that (and it makes sense, somehow).
>
> Is there anything I've overlooked? Or do I have to hack the (or
> roll-my-own) lexer for that?
>
> Thanks for any insight
>
> cheers
> -- t

I assume you mean providing source location information to the
values (i.e, $1, etc).  I've thought about that a few times but have
not arrived at anything intelligent.  Maybe using object properties
(see sec 6.11 in Guile Ref) in the lexical analyzer, as you mention.

Take care,
Matt




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: NYACC: getting source location info?
  2020-07-11  3:00 ` Matt Wette
@ 2020-07-11  8:10   ` tomas
  0 siblings, 0 replies; 3+ messages in thread
From: tomas @ 2020-07-11  8:10 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

On Fri, Jul 10, 2020 at 08:00:15PM -0700, Matt Wette wrote:

Hey, and thanks for your quick response!

> On 7/10/20 1:37 PM, tomas@tuxteam.de wrote:
> >Hi,
> >
> >I'm having some fun with NYACC (thanks, Matt!).
> >
> >To help debugging things and for errors and warnings, it'd be nice
> >to "know" where the current LHS non-terminal starts in the source.

[...]

> I assume you mean providing source location information to the
> values (i.e, $1, etc).

Yes, basically.

I was just looking from the other end of the rule (and pictured
having a "special symbol" like $loc giving the "start point" of
the curent LHS). Both would be equivalent, I think.

>                       I've thought about that a few times but have
> not arrived at anything intelligent.  Maybe using object properties
> (see sec 6.11 in Guile Ref) in the lexical analyzer, as you mention.

I didn't think of that -- it feels pretty "side-channel-y" at first,
but perhaps it's an elegant solution, after all.

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-11  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 20:37 NYACC: getting source location info? tomas
2020-07-11  3:00 ` Matt Wette
2020-07-11  8:10   ` tomas

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).