Compilation as a Typed EDSL-to-EDSL Transformation

03/29/2016
by   Emil Axelsson, et al.
0

This article is about an implementation and compilation technique that is used in RAW-Feldspar which is a complete rewrite of the Feldspar embedded domain-specific language (EDSL) (Axelsson et al. 2010). Feldspar is high-level functional language that generates efficient C code to run on embedded targets. The gist of the technique presented in this post is the following: rather writing a back end that converts pure Feldspar expressions directly to C, we translate them to a low-level monadic EDSL. From the low-level EDSL, C code is then generated. This approach has several advantages: 1. The translation is simpler to write than a complete C back end. 2. The translation is between two typed EDSLs, which rules out many potential errors. 3. The low-level EDSL is reusable and can be shared between several high-level EDSLs. Although the article contains a lot of code, most of it is in fact reusable. As mentioned in Discussion, we can write the same implementation in less than 50 lines of code using generic libraries that we have developed to support Feldspar.

READ FULL TEXT
research
01/15/2019

Obfuscating Java Programs by Translating Selected Portions of Bytecode to Native Libraries

Code obfuscation is a popular approach to turn program comprehension and...
research
08/29/2019

ICurry

FlatCurry is a well-established intermediate representation of Curry pro...
research
02/17/2021

Automatic Generation of Interpolants for Lattice Samplings: Part II – Implementation and Code Generation

In the prequel to this paper, we presented a systematic framework for pr...
research
10/23/2017

Strategy Preserving Compilation for Parallel Functional Code

Graphics Processing Units (GPUs) and other parallel devices are widely a...
research
08/23/2017

More declarative tabling in Prolog using multi-prompt delimited control

Several Prolog implementations include a facility for tabling, an altern...
research
12/07/2022

Systematic review of automatic translation of high-level security policy into firewall rules

Firewalls are security devices that perform network traffic filtering. T...
research
05/16/2023

On the implementation of checkpointing with high-level algorithmic differentiation

Automated code generation allows for a separation between the developmen...

Please sign up or login with your details

Forgot password? Click here to reset