Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Error predicate determination with SmPL?
Date: Mon, 13 Jul 2015 18:19:18 +0200	[thread overview]
Message-ID: <55A3E506.90905@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.10.1507130657040.2561@hadrien>

> You can get the AST if you write a script using OCaml:
> 
> (stringrep,astrep) << r.express;

I try to get another small SmPL experiment like the following running.

@initialize:ocaml@
@@
let show_positions f_name typ name_places ex_string ex_ASG e_places =
(* First loop? *)
Printf.printf "%s|%s\n" f_name typ;
(* Second loop? *)
Printf.printf "%s\n" ex_string

@returns@
expression express;
identifier work;
position e_pos, name_pos;
type return_type;
@@
 return_type work at name_pos(...)
 {
  ...
  return express at e_pos;
  ...
 }

@script:ocaml display depends on returns@
f_name << returns.work;
typ << returns.return_type;
(ex_string,ex_ASG) << returns.express;
e_places << returns.e_pos;
name_places << returns.name_pos;
@@
show_positions f_name typ name_places ex_string ex_ASG e_places


elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch.opt -sp-file show_returns2.cocci API-test1.c
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
Using native version of ocamlc/ocamlopt/ocamldep
ocamlopt.opt -shared -o /tmp/ocaml_cocci_368f40.cmxs -g -I /usr/lib64/ocaml  -I /usr/local/lib/coccinelle/ocaml /tmp/ocaml_cocci_368f40.ml
File "/tmp/ocaml_cocci_368f40.ml", line 15, characters 6-36:
Error: Unbound value Iteration.add_pending_instance
Fatal error: exception Yes_prepare_ocamlcocci.CompileFailure("/tmp/ocaml_cocci_368f40.ml")


Can you better explain the shown error messages than me?

Does my OCaml approach contain mistakes?

How can your software library help with pretty-printing of the syntax graph?

Regards,
Markus

  parent reply	other threads:[~2015-07-13 16:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  7:19 [Cocci] Error predicate determination with SmPL? SF Markus Elfring
2015-07-13 10:55 ` SF Markus Elfring
2015-07-13 11:00   ` Julia Lawall
2015-07-13 11:14     ` SF Markus Elfring
2015-07-13 11:46       ` Julia Lawall
2015-07-13 12:01         ` SF Markus Elfring
2015-07-13 13:00         ` [Cocci] Data processing for expression ASTs SF Markus Elfring
2015-07-13 16:19     ` SF Markus Elfring [this message]
2015-07-13 17:02       ` [Cocci] Error predicate determination with SmPL? Julia Lawall
2015-07-13 17:10         ` SF Markus Elfring
2015-07-13 17:20         ` SF Markus Elfring
2015-07-13 17:24           ` Julia Lawall
2015-07-13 17:39             ` [Cocci] Checking of OCaml functionality SF Markus Elfring
2015-07-13 17:48               ` Julia Lawall
2015-07-13 18:03                 ` SF Markus Elfring
2015-07-13 18:07                   ` Julia Lawall
2015-07-13 18:11                     ` SF Markus Elfring
2015-07-13 18:15                       ` Julia Lawall

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=55A3E506.90905@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox