Leif Andersen

h-index3
3papers
33citations

3 Papers

6.0PLMar 16
Mixing Visual and Textual Code

Leif Andersen, Michael Ballantyne, Cameron Moy et al.

The dominant programming languages support nothing but linear text to express domain-specific geometric ideas. What is needed are hybrid languages that allow developers to create visual syntactic constructs so that they can express their ideas with a mix of textual and visual syntax tailored to an application domain. This mix must put the two kinds of syntax on equal footing and, just as importantly, the extended language must not disrupt a programmer's typical workflow. This means that any new visual syntax should be a proper language extension that is composable with other language features. Furthermore, the extensions should also preserve static reasoning about the program. This paper presents Hybrid ClojureScript the first such hybrid programming language. Hybrid ClojureScript allows programmers to add visual interactive syntax and to embed instances of this syntax within a program's text. An enhanced hybrid IDE can then display these embedded instances as mini-GUIs that programmers interact with, while other IDEs will show a textual representation of the syntax. The paper argues the necessity of such an extensibility mechanism, demonstrates the adoptability of the design, and discusses what might be needed to use the design in other languages.

2.4CPJun 25
Valuing American options and Flexible Forwards contracts in time-dependent models

Leif Andersen, Andrey Itkin, Rakhymzhan Kazbek

A flexible forward (FF) is a customized FX hedging instrument that guarantees a fixed exchange rate while letting the holder choose the delivery date within a pre-agreed window. It is therefore an American-style option on timing, and its valuation must respect the volatility skew of the underlying currency pair. We price FF contracts (and, more generally, American options) under a time-inhomogeneous Heston model which captures the forward-skew term structure while preserving analytical tractability through a recursive (matrix) Riccati solution for the joint characteristic function. Extending the integral-equation (decomposition) approach to time-dependent coefficients, we derive a Volterra equation characterizing the early-exercise surface. The expectation in the decomposition formula is evaluated by two complementary spectral methods: a double cosine (COS) expansion of the transition density, and a damped-Sinc (DSINC) local-basis scheme that is more accurate and stays robust when a low Feller ratio or large vol-of-vol induces Gibbs oscillations in the COS series. Benchmarked against a penalty-iteration MCS-ADI finite-difference solver, both methods price a contract in about 1-2 seconds, roughly an order of magnitude faster than the finest finite-difference grid, while DSINC improves median accuracy over COS by about a factor of twelve. The experiments also show that the early-exercise surface is a substantially nonlinear function of the variance, contrary to the linear-in-variance approximation common in earlier work.

3.3PLOct 23, 2020Code
Adding Interactive Visual Syntax to Textual Code

Leif Andersen, Michael Ballantyne, Matthias Felleisen

Many programming problems call for turning geometrical thoughts into code: tables, hierarchical structures, nests of objects, trees, forests, graphs, and so on. Linear text does not do justice to such thoughts. But, it has been the dominant programming medium for the past and will remain so for the foreseeable future. This paper proposes a novel mechanism for conveniently extending textual programming languages with problem-specific visual syntax. It argues the necessity of this language feature, demonstrates the feasibility with a robust prototype, and sketches a design plan for adapting the idea to other languages.