1,269 research outputs found
FliPpr: A Prettier Invertible Printing System
When implementing a programming language, we often write
a parser and a pretty-printer. However, manually writing both programs
is not only tedious but also error-prone; it may happen that a pretty-printed
result is not correctly parsed. In this paper, we propose FliPpr,
which is a program transformation system that uses program inversion
to produce a CFG parser from a pretty-printer. This novel approach
has the advantages of fine-grained control over pretty-printing, and easy
reuse of existing efficient pretty-printer and parser implementations
Refactoring pattern matching
Defining functions by pattern matching over the arguments is advantageous for understanding and reasoning, but it tends to expose the implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to program refactoring based on a right-invertible language rinv—every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation, while maintaining simple and sound reasoning
Renaming Global Variables in C Mechanically Proved Correct
Most integrated development environments are shipped with refactoring tools.
However, their refactoring operations are often known to be unreliable. As a
consequence, developers have to test their code after applying an automatic
refactoring. In this article, we consider a refactoring operation (renaming of
global variables in C), and we prove that its core implementation preserves the
set of possible behaviors of transformed programs. That proof of correctness
relies on the operational semantics of C provided by CompCert C in Coq.Comment: In Proceedings VPT 2016, arXiv:1607.0183
Amalia -- A Unified Platform for Parsing and Generation
Contemporary linguistic theories (in particular, HPSG) are declarative in
nature: they specify constraints on permissible structures, not how such
structures are to be computed. Grammars designed under such theories are,
therefore, suitable for both parsing and generation. However, practical
implementations of such theories don't usually support bidirectional processing
of grammars. We present a grammar development system that includes a compiler
of grammars (for parsing and generation) to abstract machine instructions, and
an interpreter for the abstract machine language. The generation compiler
inverts input grammars (designed for parsing) to a form more suitable for
generation. The compiled grammars are then executed by the interpreter using
one control strategy, regardless of whether the grammar is the original or the
inverted version. We thus obtain a unified, efficient platform for developing
reversible grammars.Comment: 8 pages postscrip
Zero Shot Learning for Code Education: Rubric Sampling with Deep Learning Inference
In modern computer science education, massive open online courses (MOOCs) log
thousands of hours of data about how students solve coding challenges. Being so
rich in data, these platforms have garnered the interest of the machine
learning community, with many new algorithms attempting to autonomously provide
feedback to help future students learn. But what about those first hundred
thousand students? In most educational contexts (i.e. classrooms), assignments
do not have enough historical data for supervised learning. In this paper, we
introduce a human-in-the-loop "rubric sampling" approach to tackle the "zero
shot" feedback challenge. We are able to provide autonomous feedback for the
first students working on an introductory programming assignment with accuracy
that substantially outperforms data-hungry algorithms and approaches human
level fidelity. Rubric sampling requires minimal teacher effort, can associate
feedback with specific parts of a student's solution and can articulate a
student's misconceptions in the language of the instructor. Deep learning
inference enables rubric sampling to further improve as more assignment
specific student data is acquired. We demonstrate our results on a novel
dataset from Code.org, the world's largest programming education platform.Comment: To appear at AAAI 2019; 9 page
Recommended from our members
Translating Between Programming Languages Using A Canonical Representation And Attribute Grammar Inversion
Automatic translation between programming languages is an important tool for increasing program reusability. Often the need arises to transport a large software system from one source language environment to another. Performing such a translation by hand is a large undertaking, costly in manpower and very error-prone. For this reason, several researchers have built automated tools to aid them in particular such projects [3, 1]. In this paper we present a new methodology for building source-to-source translators. This methodology involves designing a canonical form to represent programs of all source languages involved, and using attribute grammars (AGs) and automatic AG-inversion to build bidirectional translators between the various source languages and the canonical form. To test the feasibility of these ideas, we have created a system to translate between the C and Pascal programming languages
Tail recursion transformation for invertible functions
Tail recursive functions allow for a wider range of optimisations than
general recursive functions. For this reason, much research has gone into the
transformation and optimisation of this family of functions, in particular
those written in continuation passing style (CPS).
Though the CPS transformation, capable of transforming any recursive function
to an equivalent tail recursive one, is deeply problematic in the context of
reversible programming (as it relies on troublesome features such as
higher-order functions), we argue that relaxing (local) reversibility to
(global) invertibility drastically improves the situation. On this basis, we
present an algorithm for tail recursion conversion specifically for invertible
functions. The key insight is that functions introduced by program
transformations that preserve invertibility, need only be invertible in the
context in which the functions subject of transformation calls them. We show
how a bespoke data type, corresponding to such a context, can be used to
transform invertible recursive functions into a pair of tail recursive function
acting on this context, in a way where calls are highlighted, and from which a
tail recursive inverse can be straightforwardly extracted.Comment: Submitted to 15th Conference on Reversible Computation, 202
- …