archive-fr.com » FR » N » NICOLASPOUILLARD.FR

Total: 307

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • original OCaml syntax Camlp4OCamlRevisedParser The revised OCaml syntax Camlp4OCamlReloadedParser An alternative syntax that can be plugged on top of original syntax or the revised one Camlp4QuotationExpander Add quotations in a reflective way same syntax as the base language Camlp4OCamlOriginalQuotationExpander OCaml quotations in the original syntax Camlp4OCamlRevisedQuotationExpander OCaml quotations in the revised syntax Camlp4OCamlParserParser Camlp4OCamlRevisedParserParser The parser and stream syntax Camlp4GrammarParser The syntax of extensible grammars EXTEND END Camlp4ListComprehension List comprehension as a syntactic sugar Camlp4MacroParser Macros like IFDEF DEFINE INCLUDE FILE Camlp4DebugParser A debug keyword for auto removable debugging info Camlp4AstLoader Load an Camlp4Ast marshalled value Camlp4Printers in fact the real implementation of them is in Camlp4 Printers Camlp4OCamlPrinter A re write from scratch OCaml original syntax pretty printer Camlp4OCamlRevisedPrinter Revised pretty printer Camlp4AstDumper Camlp4OCamlAstDumper Marshalling functions of trees for the OCaml compiler and Camlp4 itself Camlp4NullDumper Print nothing Camlp4AutoPrinter Choose either Camlp4OCamlPrinter or Camlp4OCamlAstDumper depending on the tty Camlp4Filters Camlp4ExceptionTracer Add try with blocks around the body of functions that prints with the location and re raise any exception useful for debugging Camlp4MapGenerator Grab type definitions and generate map functions to traverse these structures Camlp4FoldGenerator Grab type definitions and generate fold functions to traverse these structures Camlp4MetaGenerator Grab type definitions and generate functions to lift your structure to the syntax of it Camlp4AstLifter Associate to a tree the program that produces it f 42 App Id f Int 42 expr f 42 Camlp4LocationStripper Replace all location information by the ghost location Camlp4Tracer Trace all function calls Camlp4Profiler Generates call to a counting function Camlp4TrashRemover Removes the Camlp4Trash module Camlp4Top Top The main top level plugin for the OCaml top level Rprint The revised pretty printer for values Syntax extensions changes Before Let two grammar extensions in the old syntax dynamic old syntax ml and static old syntax ml dynamic old syntax ml type t1 A B type t2 Foo of string t1 open Pcaml let foo Entry mk gram foo let bar Entry mk gram bar EXTEND GLOBAL foo bar foo foo i LIDENT b bar Foo i b bar A B END Entry parse foo Stream of string foo x Foo x A DELETE RULE foo foo LIDENT bar END static old syntax ml type t1 A B type t2 Foo of string t1 module Gram Grammar GMake let foo Gram Entry mk foo let bar Gram Entry mk bar GEXTEND Gram GLOBAL foo bor foo foo i LIDENT b bar Foo i b bar A B END Gram Entry parse foo Stream of string foo x Foo x A GDELETE RULE Gram foo foo LIDENT bar END The quick and non extensible way the Camlp4 PreCast module quick non extensible example ml This scheme only works when the grammar value is not really used for other things than entry creation In fact grammars are now static by default type t1 A B type t2 Foo of string t1 open Camlp4 PreCast open Syntax let foo Gram Entry mk foo let bar Gram Entry mk bar EXTEND Gram

    Original URL path: http://nicolaspouillard.fr/camlp4-changes.html (2015-10-11)
    Open archived version from archive


  • Rénovation du sous-système Camlp4 d'Objective Caml
    PreCast propose un assemblage par défaut Il consiste en une série d applications de foncteurs Modules accessibles via PreCast Loc Ast Token Lexer Gram Quotation Syntax AstFilters Ajout et remplacement Un nouvel analyseur lexical Un nouvel analyseur lexical Utilise ocamllex plutôt qu un parseur de flots Ré entrant plus d état global Style fonctionnel dans la gestion des structures imbriquées Ignorant et indépendant des mots clés Supporte les quotations imbriquées Ne cache aucune information commentaires blancs Un seul inconvénient devient Ajout d un système de filtrage Camlp4 un traducteur source à source Camlp4 parse et pretty printe Camlp4 traduit Plusieurs parseurs et extensions OCaml OCamlr Grammar De pretty printeurs OCaml OCamlr Syntaxe originale vers révisée camlp4 parser OCaml printer OCamlr Désucrer la syntaxe camlp4boot printer OCaml Des filtres et la transformation de programmes devient possible Un filtre se place entre le parseur et le pretty printeur Un filtre est une fonction qui transforme un Ast Ces fonctions sont enregistrées auprès d un gestionnaire Utilisation commune Parcourir l arbre en profondeur Filtrer un motif le remplacer x 0 x Pour cela des fonctions map sont nécessaires Map généré filtrage aisé Filtrer toutes les catégories syntaxiques 17 catégories 200 constructeurs Solution retenue proche de celle d Cαml Génère une classe à partir de la définition du type Propose une méthode par catégorie Il suffit d en dériver De redéfinir une ou plusieurs méthodes De filtrer le motif voulu De déléguer les autres cas à la classe supérieure Filtres disponibles et exemple open Camlp4 PreCast let f object self inherit Ast map as super method expr function expr x 0 expr 0 x self expr x e super expr e end in AstFilters register str item f str item ExceptionTracer Tracer Décorent le corps des fonctions LiftCamlp4Ast Retourne le programme qui engendre cet arbre Réécriture des pretty printeurs Réécriture des pretty printeurs Se rapprocher de la technologie standard Utilisation du module Format Parcours récursif descendant Parenthésage géré manuellement Les autres choix de design Une classe fonctionnelle extensibilité gestion de l état Filtrage à l aide des quotations Priorités et structures ambiguës Ambiguïté contextuelle du parenthésage Les structures comme match try et function L utilisation des points virgules Résolution à l aide de l état que porte l objet match x with A y let y y 2 in match y with Extension des grammaires extensibles Les grammaires extensibles de Camlp4 EXTEND Gram expr x expr y expr x y x expr y expr x y x expr y expr x y x expr y expr x y x INT int of string x e expr e END Interface fonctorielle ou pas Deux modes étaient disponibles Interface classique Les entrées de grammaire sont du même type Les grammaires sont des valeurs accessibles Interface fonctorielle Paramétrée par un module de grammaire Les entrées sont incompatibles entre grammaires La grammaire du module n est pas accessible Maintenant Statique ancienne interface fonctorielle Dynamique interface classique paramétrée par un module Motifs de lexèmes Utilisation des motifs de lexèmes

    Original URL path: http://nicolaspouillard.fr/pub/camlp4/renovation-camlp4-longue.html (2015-10-11)
    Open archived version from archive


  • this trivial example only one working copy of Camlp4 suffices However in case of a large change my advice is to use two working copies one for parsing printing and code generation changes and the other for code change The two working copies system is needed in order to keep the compilation time reasonable when multiple changes are performed on the first one Edit the appropriate file Camlp4Parsers Grammar ml Find the extend sequence and replace it by broaden you can check that this change won t affect your running Camlp4 since it occurs inside a quotation Compile this new Camlp4 make In general one change parsers printers and code generation until satisfied by what can parse or generate this version Test it cat test ml EXTEND Gram expr END camlp4of run pr o cmo test ml let Gram extend expr expr Gram Entry t None None None Propagate the change in the whole Camlp4 Now one should change the extend definition and signature to rename it broaden In this case this involves the following files Camlp4 Sig Grammar Dynamic mli The signature for dynamic grammars Camlp4 Sig Grammar Static mli The signature for static grammars Camlp4 Struct Grammar Static

    Original URL path: http://nicolaspouillard.fr/camlp4-bootstrap.html (2015-10-11)
    Open archived version from archive


  • All where import NaPa import NaPa Worlds import NaPa Subtyping import NaPa Derived import NaPa LogicalRelation import NaPa LogicalRelation Bijection import NaPa Interface import NaPa TransKit import NaPa Examples STLC

    Original URL path: http://nicolaspouillard.fr/publis/nameless-painless.agda/ (2015-10-11)
    Open archived version from archive

  • FreshLook2010
    a safe and natural style has to a large extent remained elusive In this paper we present a novel approach to the problem Our proposal can be viewed either as a programming language design or as a library in fact it is currently implemented within Agda It provides a safe and expressive means of programming with names and binders It is abstract enough to support multiple concrete implementations we present

    Original URL path: http://nicolaspouillard.fr/publis/pouillard-pottier-fresh-look-agda-2010/ (2015-10-11)
    Open archived version from archive


  • ρ x ρ b t b ρ t ρ t u ρ t ρ u Tm Tm Tm Tm const 0 open Tm public using Tm parseTm String Tm parseTm s map Tm parseTm s parseTm T parseTm parseTm F parseTm examples List Tm examples from just parseList parseTm examples module Tm where binder String binder 0 x binder 1 y binder 2 z binder suc suc suc n x show n name x String name x binder suc x Tm Tm V x V name x t binder suc t t u t u Tm Tm Tm Tm 0 open Tm public using Tm showTm Tm String showTm t showTm Tm t Ω Tm Ω parseTm Ω References Thorsten Altenkirch 1993 A Formalization of the Strong Normalization Proof for System F in LEGO Conor McBride and James McKinna 2004 The view from the left data Tm n Set where V x Fin n Tm n t u Tm n Tm n t Tm suc n Tm n map m n Fin m Fin n Tm m Tm n map f V x V f x map f t u map f t map f u map f t map liftFin f t module Traverse m n f Fin m Tm n where tr Tm m Tm n tr V x f x tr t tr suc t tr t u tr t tr u traverse Tm m Tm n traverse tr 0 open Traverse public using renaming traverse to traverse private module Undesirable where broken add V n k Fin n Tm k n broken add V n k x rewrite assoc comm k n V Fin raise k x broken add n k Tm n Tm k n broken add k traverse broken add V k may swap app n Tm n Tm n may swap app 0 t u u t may swap app t t module Tm where n Tm Tm n V x V from x t t t u t u n Tm n Tm V x V Fin to x t u t u t t open Tm public renaming to Tm to Tm parseTm n String Tm n parseTm s Tm parseTm s parseTm n T parseTm n parseTm F parseTm showTm n Tm n String showTm t showTm Tm t module SubstTm where Set i o Tm i Tm o Set i o Fin i Tm o i o i o suc i suc o f zero V zero f suc x map suc f x i o i o i o θ V x θ x θ t θ t θ t u θ t θ u 0 n Tm n suc n n 0 u Fin elim u V β red n n n β red t u 0 u t β red t t m n Tm m Fin m Tm n Tm n t f f t n Tm n Tm n Tm n t u 0 u t t u t u eval n Tm n Tm n eval zero t t eval suc n V x V x eval suc n t u eval n eval n t u eval suc n t eval n t apTm Tm 0 apTm V 1 V 0 non closedTm Tm 1 non closedTm V 1 V 0 Ω n Tm n Ω parseTm Ω References Substitution A Formal Methods Case Study Using Monads and Transformations Françoise Bellegarde and James Hook 1994 de Bruijn Notation as a Nested Datatype Richard Bird and Ross Paterson 1999 Monadic Presentations of Lambda Terms Using Generalized Inductive Types Thorsten Altenkirch and Bernhard Reus 1999 Maybe Set Set Maybe Set Set A n Maybe suc n A zero nothing suc n just n data Tm A Set where V x A Tm A t u Tm A Tm A t Tm Maybe A Tm A map A B A B Tm A Tm B map f V x V f x map f t u map f t map f u map f t map map f t Map laws derivable from parametricity map lem f A Tm A Tm A A B g A B map g f f map g map lem f A Tm A Bool A B g A B f f map g module Tm where n Tm n A Tm Maybe n A V x V fromFin x t u t u t t open Tm renaming to Tm module Tm where n Tm Maybe n Tm n V x V toFin x t u t u t t open Tm renaming to Tm parseTm A String Tm A parseTm s map λ x Tm 0 x parseTm s parseTm A T parseTm A parseTm F parseTm showTm Tm String showTm t showTm Tm 0 t Ω A Tm A Ω parseTm Ω module SubstTm where Set Set Set A B A Tm B Set Set Set A B Tm A Tm B A B A B Maybe A Maybe B f nothing V nothing f just x map just f x A B A B A B θ V x θ x θ t u θ t θ u θ t θ t 0 A Tm A Maybe A A 0 maybe V A B Tm A A Tm B Tm B t f f t join A Tm Tm A Tm A join id β red A Tm A Tm A β red t u 0 u t β red t t A Tm A Tm A Tm A t u 0 u t t u t u eval A Tm A Tm A eval zero t t eval suc n V x V x eval suc n t u eval n eval n t u eval suc n t eval n t open SubstTm using eval renaming to 0 to 0 apTm Tm apTm V 1 V 0 non closedTm Tm Maybe non closedTm V

    Original URL path: http://nicolaspouillard.fr/publis/lfmtp2012-talk/html/binding-representations.html (2015-10-11)
    Open archived version from archive


  • terms where data Neu A Set data Sem A Set data Neu A where V A Neu A Neu A Sem A Neu A data Sem A where Sem A

    Original URL path: http://nicolaspouillard.fr/publis/lfmtp2012-talk/html/nbe-terms.html (2015-10-11)
    Open archived version from archive


  • Tm Tm norm t reify eval t module examples where t1 Tm t1 lam lam λ x lam λ y x y lam λ x x t2 Tm t2 lam lam λ z lam λ x lam λ y x y z lam λ x lam λ y x y eval A Set Tm Sem A Sem A eval V v v eval t u app eval t eval u eval f λ x eval f x reify Exp Sem Exp Tm Exp reify f λ x reify f N V x reify N n neu n module Reify where neu Neu neu V v V v neu n d neu n reify d norm Tm Tm norm t reify eval t module examples where t1 Tm t1 λ x λ y V x V y λ x V x t2 Tm t2 λ z λ x λ y V x V y V z λ x λ y V x V y id Tm id parseTm λx x true Tm true parseTm λx λ x false Tm false parseTm λ λx x pair Tm pair parseTm λx λy λf f x y fst Tm fst parseTm λtrue λp p true true parseTm λp p λx λ x snd Tm snd parseTm λfalse λp p false false parseTm λp p λ λx x uncurry Tm uncurry parseTm λtrue λfalse λf λp f p true p false true false parseTm λf λp f p λx λ x p λ λx x app Tm app parseTm λf λx f x comp Tm comp parseTm λf λg λx f g x α α α α α zero Tm zero false λf λx x suc Tm suc parseTm λn λf λx n f f x λn λf n f f add Tm add parseTm

    Original URL path: http://nicolaspouillard.fr/publis/lfmtp2012-talk/html/nbe.html (2015-10-11)
    Open archived version from archive