All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] script code on metavariables
Date: Mon, 18 Jan 2016 11:11:29 +0100	[thread overview]
Message-ID: <569CBA51.2040303@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1601170938000.2026@localhost6.localdomain6>

> Some time ago, the idea of putting constraints expressed as scripts was discussed
> (http://article.gmane.org/gmane.comp.version-control.coccinelle/1928).

I am curious if the discussion (from December 2011) will be continued
around a topic like "assignments and support for SmPL rule extensions".


> This has now been implemented,

Interesting ?


> only for position variables and only for ocaml scripting:

I hope that this software limitation can be changed anyhow
in the future.


> The basic notation is:
> 
> position p : script:ocaml(params) { expression };
> 
> Params can only be inherited metavariables.

Would you like to clarify the specification of such parameters
a bit more?


> Due to parsing constraints, the expression has to be a C expression,
> even though the script language is OCaml.

How do you think about to explain this restriction better?


> Fortunately, it is possible to make an OCaml function call that 
> looks just like a C function call.

I am unsure if I understand the consequences from this information
good enough.


> The expression can also refer to the metavariable p being defined.

Nice ?


> The expression should return true or false, ie true if the proposed value
> of p is acceptable as a match, and false if it is not.

Do you describe the introduction of generic predicate functions here?


> A real-life example is:
> position jp : script:ocaml() { check_in_a_hunk("P",plus_hunks,jp) };
> 
> Any thoughts about the syntax?  For example, I don't think that the 
> script: and the { } are strictly necessary from a parsing point of view.

I find that extra delimiter characters will help to make such
source code a bit easier to read.


> This could be extended to other metavariable types, and eventully to Python.

I am curious on corresponding software evolution.

Regards,
Markus

  reply	other threads:[~2016-01-18 10:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17  8:47 [Cocci] script code on metavariables Julia Lawall
2016-01-18 10:11 ` SF Markus Elfring [this message]
2016-01-18 10:15   ` Julia Lawall
2016-01-18 10:30     ` SF Markus Elfring
2016-01-18 10:43       ` Julia Lawall
2016-01-18 12:00         ` SF Markus Elfring
2016-01-18 12:05           ` Julia Lawall
2016-01-18 12:28             ` SF Markus Elfring
2016-01-18 20:25         ` [Cocci] Documentation check for parallelisation support? SF Markus Elfring

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=569CBA51.2040303@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.