21,234 research outputs found
Extended Initiality for Typed Abstract Syntax
Initial Semantics aims at interpreting the syntax associated to a signature
as the initial object of some category of 'models', yielding induction and
recursion principles for abstract syntax. Zsid\'o proves an initiality result
for simply-typed syntax: given a signature S, the abstract syntax associated to
S constitutes the initial object in a category of models of S in monads.
However, the iteration principle her theorem provides only accounts for
translations between two languages over a fixed set of object types. We
generalize Zsid\'o's notion of model such that object types may vary, yielding
a larger category, while preserving initiality of the syntax therein. Thus we
obtain an extended initiality theorem for typed abstract syntax, in which
translations between terms over different types can be specified via the
associated category-theoretic iteration operator as an initial morphism. Our
definitions ensure that translations specified via initiality are type-safe,
i.e. compatible with the typing in the source and target language in the
obvious sense. Our main example is given via the propositions-as-types
paradigm: we specify propositions and inference rules of classical and
intuitionistic propositional logics through their respective typed signatures.
Afterwards we use the category--theoretic iteration operator to specify a
double negation translation from the former to the latter. A second example is
given by the signature of PCF. For this particular case, we formalize the
theorem in the proof assistant Coq. Afterwards we specify, via the
category-theoretic iteration operator, translations from PCF to the untyped
lambda calculus
Pattern matching in compilers
In this thesis we develop tools for effective and flexible pattern matching.
We introduce a new pattern matching system called amethyst. Amethyst is not
only a generator of parsers of programming languages, but can also serve as an
alternative to tools for matching regular expressions.
Our framework also produces dynamic parsers. Its intended use is in the
context of IDE (accurate syntax highlighting and error detection on the fly).
Amethyst offers pattern matching of general data structures. This makes it a
useful tool for implementing compiler optimizations such as constant folding,
instruction scheduling, and dataflow analysis in general.
The parsers produced are essentially top-down parsers. Linear time complexity
is obtained by introducing the novel notion of structured grammars and
regularized regular expressions. Amethyst uses techniques known from compiler
optimizations to produce effective parsers.Comment: master thesi
Arrays, bounded quantification and iteration in logic and constraint logic programming
We claim that programming within the logic programming paradigm suffers from lack of attention given to iteration and arrays. To convince the reader about their merits we present several examples of logic and constraint logic programs which use iteration and arrays instead of explicit recursion and lists. These programs are substantially simpler than their counterparts written in the conventional way. They are easier to write and to understand, are guaranteed to terminate and their declarative character makes it simpler to argue about their corr
- …