Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Oct 2014 12:22:43 -0700
From:      Mark Johnston <markj@freebsd.org>
To:        Bryan Cantrill <bryancantrill@gmail.com>
Cc:        "dtrace-discuss@lists.dtrace.org" <dtrace-discuss@lists.dtrace.org>, freebsd-dtrace@freebsd.org
Subject:   Re: [dtrace-discuss] dtrace keywords in postfix expressions
Message-ID:  <20141004192243.GC22999@charmander.picturesperfect.net>
In-Reply-To: <CAAm8y%2BjJcp9=3DywYO%2B3gYRPbCtTR4g_H0fJ9CdPV7No0rac7Q@mail.gmail.com>
References:  <20141004041300.GA21821@charmander.picturesperfect.net> <CAAm8y%2BjJcp9=3DywYO%2B3gYRPbCtTR4g_H0fJ9CdPV7No0rac7Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 04, 2014 at 12:59:57AM -0700, Bryan Cantrill wrote:
> Nothing like cracking open dt_grammar.y to get the blood flowing! ;)

Made for a fun Friday evening. :)

> I
> don't think the change looks unreasonable; how does the test suite fare?
> If this is no way breaks extant D programs, I'm all for it...

I don't see any regressions in the test suite. In principle this
shouldn't break anything - it just increases the number of valid D
programs without affecting the parse trees of existing programs.

I updated the patch to handle the offsetof() rule (so that
"offsetof(struct g_consumer, provider)" now works), and the "stringof"
keyword. If there aren't any objections I'll commit it to FreeBSD in a
few days and submit a PR for illumos.

Thanks,
-Mark

> 
>         - Bryan
> 
> 
> On Fri, Oct 3, 2014 at 9:13 PM, Mark Johnston via dtrace-discuss <
> dtrace-discuss@lists.dtrace.org> wrote:
> 
> > Hello,
> >
> > DTrace has a few keywords which are not keywords in C/C++ (e.g.
> > "provider"). One annoyance which has come up a few times is the fact
> > that such keywords cannot be used in expressions which would be valid in
> > the code being traced. For example, FreeBSD's struct g_consumer contains
> > a field called "provider", and attempting to run the following snippet of
> > D results in a syntax error:
> >
> > fbt::g_vfs_done:entry {printf("%s",
> > stringof(args[0]->bio_from->provider->name));}
> >
> > I don't see any reason the D grammar can't support this, however. The
> > patch at [1] attempts to fix this problem by allowing certain keywords
> > to appear in the place of identifiers in postfix expressions. It's not a
> > complete solution since it doesn't handle types or probe names, but it's a
> > start. Any thoughts on this approach?
> >
> > Thanks!
> > -Mark
> >
> > [1] http://people.freebsd.org/~markj/patches/dtrace_keywords.diff
> >
> >
> > -------------------------------------------
> > dtrace-discuss
> > Archives: https://www.listbox.com/member/archive/184261/=now
> > RSS Feed:
> > https://www.listbox.com/member/archive/rss/184261/21484475-e7237b25
> > Modify Your Subscription:
> > https://www.listbox.com/member/?member_id=21484475&id_secret=21484475-2fcb7543
> > Powered by Listbox: http://www.listbox.com
> >



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141004192243.GC22999>