From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: *** X-Spam-Status: No, score=3.4 required=5.0 tests=AWL,DNS_FROM_RFC_POST, DNS_FROM_SECURITYSAGE,MSGID_MULTIPLE_AT autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 493D8BB84 for ; Fri, 31 Oct 2008 17:22:03 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhYEAFLNCknAXQIngWdsb2JhbACUDgEBFiK5WgeDSg X-IronPort-AV: E=Sophos;i="4.33,523,1220220000"; d="scan'208";a="30983087" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 31 Oct 2008 17:22:02 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m9VGM2oD005624 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 31 Oct 2008 17:22:02 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnAAANPMCkmArgWokWdsb2JhbACUDgEBAQEJCwoHEQS5UQeDSg X-IronPort-AV: E=Sophos;i="4.33,523,1220220000"; d="scan'208";a="16723666" Received: from expredir7.cites.uiuc.edu ([128.174.5.168]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Oct 2008 17:22:01 +0100 Received: from axyr (aryx.cs.uiuc.edu [128.174.236.106]) by expredir7.cites.uiuc.edu (8.14.2/8.14.2) with ESMTP id m9VGLxaG016699; Fri, 31 Oct 2008 11:21:59 -0500 (CDT) To: OCaml Subject: announce : Yacfe 0.2 From: Yoann Padioleau Date: Fri, 31 Oct 2008 11:20:54 -0500 Message-ID: <87abckzqft.fsf@pad@uiuc.edu> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 490B30AA.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 syntax:01 newlines:01 cpp:01 cpp:01 preprocessed:01 idioms:01 'list:01 printf:01 syntax:01 iterators:01 gpl:01 abstract:01 abstract:01 parsing:01 Dear list, I am pleased to announce the first release of Yacfe, Yet Another C/C++ Front-End, which is an OCaml API to write style-preserving source-to-source transformations such as refactorings on C or C++ source code. The goal of Yacfe is to parse the code as-is, and to represent it internally as-is. Yacfe thus maintain in the abstract syntax tree (AST) as much information as possible so that one can transform this AST and unparse it in a new file while preserving the coding style of the original file. Yacfe preserves the whitespaces, newlines, indentation, and comments from the original file, as well as the C preprocessor (cpp) macros and cpp directives. Other source-to-source transformation tools such as CIL [1] do not preserve this coding style as they first call cpp on the original file and perform the transformation on the preprocessed file. The AST of Yacfe on the opposite contains explicit constructions representing cpp directives, macro definitions, or cpp idioms such as macro iterators as in 'list_for_each(i, x) { printf("%d", x); }'. "What You See In The Yacfe AST Is What Was Written". The Yacfe abstract syntax tree is thus in fact more a concrete syntax tree (cf parsing_c/ast_c.ml). Yacfe is free software under GPL license and is available at http://aryx.kicks-ass.org/~pad/software-yacfe.php A simple example of the code of a style-preserving program transformation using the Yacfe API is available here: http://aryx.kicks-ass.org/~pad/software/project-yacfe/simple_zero_to_null.ml.html If you want to do fancy static analysis on C code, use CIL [1], it is better equiped for that task, more robust, more mature. If you want to do style-preserving source-to-source transformation, well, you may find Yacfe useful. [1] http://manju.cs.berkeley.edu/cil/ PS: Yacfe was extracted from the code of the Coccinelle project http://www.emn.fr/x-info/coccinelle/ for Linux device drivers evolutions. Yacfe was supported mainly by money from l'Ecole des Mines de Nantes as well as money from the University of Urbana-Champaign.