OriRoth / flunct

A functional fluent API generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flunct—A Functional Fluent API Generator

DOI

Flunct embeds domain-specific languages (DSLs) in SML. Flunct compiles a given FSM M specifying the DSL syntax into a functional fluent API that validates M at compile time, so only legal DSL programs may compile. For example, we can used Flunct to embed a subset of HTML in SML, making it possible to write HTML webpages as part of an SML code:

open HTML

val webpage = ^^
    <html>
    	<body>
    		<h1> `"National Parks" </h1>
    		`"California:"
    		<table>
    			<tr>
    				<th> `"Park Description" </th>
    				<th> `"Park Picture" </th>
    			</tr>
    			<tr>
    				<td> <p> <b> `"Yosemite" </b> `"national park" </p> </td>
    				<td> <img src "https://tinyurl.com/yosemite5"/> </td>
    			</tr>
    		</table>
    	</body>
    </html>
$$

You can find this and other examples in flunct/examples.

Code

The Flunct source is found in flunct/src. The code is fully documented.

Tests

The tests are found in flunct/tests. To run the tests, run run_all.sml.

Experiments

We used Flunct to conduct a series of experiments to measure the code size and compilation time of the three fluent API generation methods. The experiment sources are found in flunct/experiments. To run an experiment, uncomment the relevant code in run_experiments.sml and run the file.

About

A functional fluent API generator


Languages

Language:Standard ML 100.0%