Today\'s applications require mixing and matching languages, platforms, and paradigms, which increases a solution\'s complexity. The authors propose a lighter approach that borrows a desired paradigm and incor...
详细信息
Today\'s applications require mixing and matching languages, platforms, and paradigms, which increases a solution\'s complexity. The authors propose a lighter approach that borrows a desired paradigm and incorporates it as an integral part of a preferred development environment. They\'ve applied metaprogramming to internalize the ontology-modeling paradigm into a programming environment that\'s based on the Java ecosystem. Their method is also lightweight and suitable for small teams. They implemented an embedded domain-specific metalanguage, called Magic Potion, in the Clojure development environment, where it blends ontology, functional, object-oriented, and concurrent paradigms.
This paper extends Definite Clause Grammars (DCGs) by a metaprogramming facility which supports sequences of items (terminals, nonterminals, Prolog goals, etc.) as values of variables. Variables may be employed themse...
详细信息
This paper extends Definite Clause Grammars (DCGs) by a metaprogramming facility which supports sequences of items (terminals, nonterminals, Prolog goals, etc.) as values of variables. Variables may be employed themselves as a new sort of item in the right-hand side of a rule, in order to activate the respective item sequences they are instantiated to. In addition, so-called assignments render it possible to save the terminal string derived from an item (or even from an item sequence) in a variable for later manipulation, or to unify it with another string. The new approach, called Assignment Metagrammars (AMGs), is compared with H. Abramson's meta-nonterminals and the Discontinuous Grammars (DGs) or Gapping Grammars (GGs) proposed by V. Dahl and H. Abramson. AMGs are implemented by a complier that translates them into efficient Prolog programs.
We describe the metaprogramming framework currently used in Lean, an interactive theorem prover based on dependent type theory. This framework extends Lean's object language with an API to some of Lean's inter...
详细信息
We describe the metaprogramming framework currently used in Lean, an interactive theorem prover based on dependent type theory. This framework extends Lean's object language with an API to some of Lean's internal structures and procedures, and provides ways of reflecting object-level expressions into the metalanguage. We provide evidence to show that our implementation is performant, and that it provides a convenient and flexible way of writing not only small-scale interactive tactics, but also more substantial kinds of automation.
We demonstrate a new idea of a parallel GPU JSON parser, which is able to optimize the parsing and initial transformation process through metaprogramming. It outperforms other well-known solutions like simdjson, Panda...
详细信息
ISBN:
(纸本)9781665473309
We demonstrate a new idea of a parallel GPU JSON parser, which is able to optimize the parsing and initial transformation process through metaprogramming. It outperforms other well-known solutions like simdjson, Pandas, as well as cuDFwhich also works on GPU. The resulting data is ready to be further processed in common data frame formats and may be incorporated by RAPIDS, Apache Arrow or Pandas. Our parser can therefore be a part of an industrial Extract-Transform-Load workflow.
This article proposes to use C++ template metaprogramming techniques to decide at compile-time which parts of a code sequence in a loop can be parallelized. The approach focuses on characterizing the way a variable is...
详细信息
ISBN:
(纸本)9781538678794
This article proposes to use C++ template metaprogramming techniques to decide at compile-time which parts of a code sequence in a loop can be parallelized. The approach focuses on characterizing the way a variable is accessed in a loop (reading or writing), first to decide how the loop should be split to enable the analysis for parallelization on each part, and then to decide if the iterations inside each loop are independent so that they can be run in parallel. The conditions that enable the parallelization of a loop are first explained to justify the proposed decision algorithm exposed. Then, a C++ library-based solution is presented that uses expression templates to get the relevant information necessary for the parallelization decision of a loop, and metaprograms to decide whether to parallelize the loop and generate a parallel code.
One of the most fundamental aspects of quantum circuit design is the concept of families of circuits parametrized by an instance size. As in classical programming, metaprogramming allows the programmer to write entire...
详细信息
ISBN:
(纸本)9783030215002;9783030214999
One of the most fundamental aspects of quantum circuit design is the concept of families of circuits parametrized by an instance size. As in classical programming, metaprogramming allows the programmer to write entire families of circuits simultaneously, an ability which is of particular importance in the context of quantum computing as algorithms frequently use arithmetic over non-standard word lengths. In this work, we introduce metaQASM, a typed extension of the openQASM language supporting the metaprogramming of circuit families. Our language and type system, built around a lightweight implementation of sized types, supports subtyping over register sizes and is moreover type-safe. In particular, we prove that our system is strongly normalizing, and as such any well-typed metaQASM program can be statically unrolled into a finite circuit.
Many metaprogramming tasks, such as refactorings, automated bug fixing, or large-scale software renovation, require high-fidelity source code transformations - transformations which preserve comments and layout as muc...
详细信息
ISBN:
(纸本)9781450370967
Many metaprogramming tasks, such as refactorings, automated bug fixing, or large-scale software renovation, require high-fidelity source code transformations - transformations which preserve comments and layout as much as possible. Abstract syntax trees (ASTs) typically abstract from such details, and hence would require pretty printing, destroying the original program layout. Concrete syntax trees (CSTs) preserve all layout information, but transformation systems or parsers that support CSTs are rare and can be cumbersome to use. In this paper we present separator syntax trees (SSTs), a lightweight syntax tree format, that sits between AST and CSTs, in terms of the amount of information they preserve. SSTs extend ASTs by recording textual layout information separating AST nodes. This information can be used to reconstruct the textual code after parsing, but can largely be ignored when implementing high-fidelity transformations. We have implemented SSTs in Rascal, and show how it enables the concise definition of high-fidelity source code transformations using a simple refactoring for C++.
GraalVM is a polyglot virtual machine for running applications written in a variety of languages such as JavaScript, Ruby, Python, R, JVM-based languages like Java, Scala, Kotlin, and LLVM-based languages such as C an...
详细信息
ISBN:
(纸本)9781450360685
GraalVM is a polyglot virtual machine for running applications written in a variety of languages such as JavaScript, Ruby, Python, R, JVM-based languages like Java, Scala, Kotlin, and LLVM-based languages such as C and C++. GraalVM enables interoperability between different programming languages in a shared runtime, and can run either standalone or embedded in other software systems such as ***, the Oracle RDBMS, and MySQL. In this talk I will give an overview of GraalVM, and I will present how polyglot features such as language interoperability and language-agnostic instrumentation are enabled in GraalVM by means of VM-internal metaprogramming.
Functional programming languages are excellent for hosting embedded domain specific languages (eDSLs) because of their rich type systems, minimal syntax, and referential transparency. However, data types defined in th...
详细信息
ISBN:
(纸本)9781450398312
Functional programming languages are excellent for hosting embedded domain specific languages (eDSLs) because of their rich type systems, minimal syntax, and referential transparency. However, data types defined in the host language are not automatically available in the embedded language. To do so, all the operations on the data type must be ported to the eDSL resulting in a lot of boilerplate. This paper shows that by using metaprogramming, all first-order user-defined data types can be automatically made first class in shallow embedded DSLs. We show this by providing an implementation in Template Haskell for a typical DSL with two different semantics. Furthermore, we show that by utilising quasiquotation, there is hardly any burden on the syntax. Finally, the paper also serves as a gentle introduction to Template Haskell.
C++ template metaprogramming has been used with great success to build software applications and libraries. In practice, however, template metaprogramming suffers usability, reliability, and capability shortcomings, a...
详细信息
ISBN:
(纸本)9781605584942
C++ template metaprogramming has been used with great success to build software applications and libraries. In practice, however, template metaprogramming suffers usability, reliability, and capability shortcomings, and it is not well understood in theory. Template metaprogramming has these problems because it relies on emergent properties of disparate language features that were tailored to other purposes. As a step toward solid and sound language support for metaprogramming, this paper establishes firm semantic foundations for select capabilities of template metaprogramming. We analyze C++ and the idioms of template metaprogramming and isolate, in a language-neutral fashion, fundamental capabilities of C++ that enable metaprogramming. Guided by this analysis, we present a design for a core calculus that directly expresses fundamental metaprogramming capabilities, including static computation, code generation, and type reflection. We prove a type-safety property for compile-time evaluation of metaprograms. To formally connect the core calculus to programming practice, we present a more convenient surface language for metaprogramming. Its semantics are captured by type-directed translation to the core calculus. We prove that this translation preserves well-typing. This idealized presentation averts some of the shortcomings of C++ template metaprogramming and provides a framework for further study.
暂无评论