From: David Gibson <david@gibson.dropbear.id.au>
To: Jon Loeliger <jdl@jdl.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 4/4] DTC: Begin the path to sane literals and expressions.
Date: Sat, 27 Oct 2007 00:03:29 +1000 [thread overview]
Message-ID: <20071026140329.GA15404@localhost.localdomain> (raw)
In-Reply-To: <E1IlOuj-0000lw-7E@jdl.com>
On Fri, Oct 26, 2007 at 08:07:49AM -0500, Jon Loeliger wrote:
> So, like, the other day David Gibson mumbled:
> >
> > Ah... I think I see the source of our misunderstanding. Sorry if I
> > was unclear. I'm not saying that the version token would be
> > invisible to the parser, just that it would be recognized by the lexer
> > first.
>
> Ah! Right. OK, I see what you are saying now.
>
> > The nice thing about having a token, is that if necessary we can
> > completely change the grammar for each version, without having to have
> > tangled rules that have to generate yyerror()s in some circumstances
> > depending on the version variable. The alternate grammars can be
> > encoded directly into the yacc rules:
> > startsymbol : version0_file
> > | V1_TOKEN version1_file
> > | V2_TOKEN version2_file
> > ;
>
> Hmmm... Now that I see that your symbol is still in the grammar,
> I can see this part as well. OK. I'll buy it.
Yay! :)
> > > > I'm also inclined to leave the syntax for bytestrings as it is, in
> > >
> > > Why? Why not be allowed to form up a series of expressions
> > > that make up a byte string? Am I missing something obvious here?
> >
> > Because part of the point of bytestrings is to provide representation
> > for binary data. For a MAC address, say
> > [0x00 0x0a 0xe4 0x2c 0x23 0x1f]
> > is way bulkier than
> > [000ae42c231f]
>
> No, I think you misuderstand what I was after. I'm not after the
> the latter [000ae4...]. In that case, there would be multiple
> expressions, each no bigger than 8 bits wide:
>
> [ expr expr expr expr expr expr ]
> [ 0x00 10 0x4 0x20+12 '0'+3 0x20 - 1 ]
>
> or whatever seemed appropriate. It would not be one giant value.
Yes, I realise that. My point is that [000ae42c231f] is valid *now*
and is a nice compact way of doing explicit bytestrings. That would
become much bulkier with your proposal.
[snip]
> > Incidentally, there's another problem here: we haven't solved the
> > problem about having to allow property names with initial digits.
>
> I know.
Yeah, have a look at my 1/2 patch - it addresses this, and I think a
bunch of related problems that would come with expression syntax.
> > That's a particular problem here, because although we can make
> > literals scanned in preference to propnames of the same length, in
> > this case
> > 0x1234..0xabcd
> > Will be scanned as one huge propname.
>
> I know. White space is mandatory right now.
Ick.
> > This might work for you at the moment, if you've still got all the
> > lexer states, but I was really hoping we could ditch most of them with
> > the new literals.
>
> Which is really why they are all still there. Longer term,
> I want to _quit_ supporting "version 0" and remove the cruft...
>
> > But you haven't actually addressed my concern about this. Actually
> > it's worse that I said then, because
> > <0x10000000 -999>
> > is ambiguous. Is it a single subtraction expression, or one literal
> > cell followed by an expression cell with a unary '-'?
>
> Gah.
>
> Paren'ed expressions may be the thing to do.
> How do you feel about comma separation?
I'm not keen on it. I think paren'ed expressions are reasonable.
Grammatically the cell values would be literal | '(' expr ')'. As
you've probably noticed in your expression research, there's generally
already a non-terminal just like that within expression grammars,
anyway.
[snip]
> > > The same call to set_dts_version() as any other case.
> >
> > Erm... which same call to set_dts_version()? Surely not the one in
> > the parser..
>
> I'm clearly not understanding your point, I'm afraid. There are
> static default values here:
>
> /*
> * DTS sourcefile version.
> */
> unsigned int dts_version = 0;
> unsigned int expr_default_base = 10;
>
> And there is a call to set_dts_version() made when any DTS file
> is parsed, which happens before any -O option is even handled.
>
> What am I missing?
The dts version for output should be independent of the dts version
for input (in fact it should probably be locked to v1). In -Idtb
-Odts mode, there will be no dts file parsed before dts output, and it
would be neat if -Idts -Odts mode would convert from v0 to v1 (another
thing on my to-do list is to change things so -Idts -Odts will
preserve labels from input to output).
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2007-10-26 14:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 17:43 [PATCH 4/4] DTC: Begin the path to sane literals and expressions Jon Loeliger
2007-10-20 8:47 ` David Gibson
2007-10-21 5:32 ` Segher Boessenkool
2007-10-22 0:37 ` David Gibson
2007-10-25 18:24 ` Jon Loeliger
2007-10-26 1:28 ` David Gibson
2007-10-26 13:07 ` Jon Loeliger
2007-10-26 14:03 ` David Gibson [this message]
2007-10-21 5:30 ` Segher Boessenkool
2007-10-22 0:51 ` David Gibson
2007-10-22 12:36 ` Jon Loeliger
2007-10-23 0:33 ` David Gibson
2007-10-23 0:57 ` Segher Boessenkool
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071026140329.GA15404@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=jdl@jdl.com \
--cc=linuxppc-dev@ozlabs.org \
/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 NNTP newsgroup(s).