devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>
Cc: devicetree-discuss
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: Some slightly random musings on device tree expression syntax
Date: Tue, 13 Mar 2012 10:57:43 +1100	[thread overview]
Message-ID: <20120312235743.GE24916@truffala.fritz.box> (raw)
In-Reply-To: <E1S75gQ-0005WK-0D-CYoMK+44s/E@public.gmane.org>

On Mon, Mar 12, 2012 at 08:53:05AM -0500, Jon Loeliger wrote:
> > I was thinking some more about how to expand the device tree syntax to
> > allow expressions.
> 
> Excellent!
> 
> > I wondered if we should use a concept/syntax more
> > inspired by template processors. Playing with jinja2 and gpp led me
> > towards (...) being an inline expression syntax that can calculate
> > integers or strings and get replaced by the string representation of the
> > expression, and ! at the start of a line introducing a statement
> > context. So, below are my somewhat wandering thoughts on the matter.
> > However, the idea still raises a lot of questions that'd need to be
> > resolved.
> > 
> > I note a few things:
> > 
> > * Using the (...) syntax to indicate which parts of the file should be
> > evaluated and the substituted solves the issue that David had with Jon's
> > proposal re: how do you know when a node name is literal text vs.
> > concatenated to some expression.
> 
> So the M4 solution then.

Erm.. use of (...) to disambiguate expressions seems an independent
matter from whether we use m4 or a macro preprocessor versus
in-dtc-proper expression evaluation.

> > * As an aside, I wonder if we couldn't transparently allow <1 2 3> or
> > <1, 2, 3> for cell list syntax, thus not requiring the brackets in
> > previously proposed <(1 + 0) (1 + 1) (4 - 1)> syntax, but rather <1 + 0,
> > 1 + 1, 4 - 1>?
> 
> That's the sort of direction I advocated earlier.

Hrm.  I don't think this is a good idea.  Having two different cell
list formats seems to me to encourage confusions for minimal benefit.
I think (...) will generally delimit expressions more readably anyway.
Especially since it would match using that syntax to distinguish
expressions in other places, like node or property names.

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

  parent reply	other threads:[~2012-03-12 23:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08  0:40 Some slightly random musings on device tree expression syntax Stephen Warren
     [not found] ` <4F580005.403-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-03-12 13:53   ` Jon Loeliger
     [not found]     ` <E1S75gQ-0005WK-0D-CYoMK+44s/E@public.gmane.org>
2012-03-12 23:57       ` David Gibson [this message]
2012-03-13  4:46   ` David Gibson
     [not found]     ` <20120313044631.GJ24916-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-03-13 19:56       ` Stephen Warren
     [not found]         ` <4F5FA653.90802-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-03-14 14:42           ` David Gibson

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=20120312235743.GE24916@truffala.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=jdl-CYoMK+44s/E@public.gmane.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).