Snippets tagged dsl
WinForms layout combinators
A domain specific language for creating layout using Windows Forms. The snippet implements combinators for creating controls and simple automatic arrangement of them.
17 people like this
Posted: 1 years ago by Tomas PetricekSmall embedded DSL to write in F# "Who is John Galt?"
This snippet how we can use F# constructs like discrimated unions, functions and symbolic identifiers to represent proper language statements (albeit limited) using valid F# code.
18 people like this
Posted: 1 years ago by Horacio NuñezA fun-ny WPF DataTemplate DSL
Parts of a little DSL to create WPF DataTemplate's in F#. Don't even want to think about the length of a corresponding C#. The F# code corresponds 1-to-1 to the visual tree constructed for the template.
5 people like this
Posted: 11 months ago by Cetin SertMiss Grant's Controller Parser
State machine example, from Martin Fowler's Domain-Specific Languages book, implemented as an External DSL parser in F#. A set of mutually recursive functions are used to parse the string tokens and build the State Machine as an F# record type.
6 people like this
Posted: 11 months ago by Phillip TrelfordTurtle
Turtle graphics library implemented as an internal DSL, providing a very similar syntax to Logo, it is runnable inside TryFSharp.org.
5 people like this
Posted: 10 months ago by Phillip TrelfordStarbucks
Simple DSL for describing cups of Starbucks coffee and computing prices (in dollars).
7 people like this
Posted: 5 months ago by Phillip TrelfordLight XML DSL
A light domain specific language for declaring xml in F# as code.
4 people like this
Posted: 5 months ago by Huw Simpson
DSL for financial contracts
Simple domain-specific language (DSL) for describing financial contracts in F#. A contract is represented using a discriminated union. Evaluating a contract gives the orders that may happen at a given date.
6 people like this
Posted: 5 months ago by Tomas PetricekFinalizing Tesco purchase
The sample shows two different reprezentations of Tesco checkout. The first one stores scanned items - as a list of either purchase or cancel items - and the second stores final bill with product and total quantity. The snippet implements transformation that corresponds to finalizing the purchase.
3 people like this
Posted: 1 months ago by Tomas PetricekTesco in 70 lines of code
Domain model for the Tesco checkout implemented in F# using discriminated unions (in 20 lines of code) and console-based user interface for scanning products and calculating the total price.
3 people like this
Posted: 1 months ago by Tomas PetricekSimple NumericLiteral example
You can use numeric literals, constant expressions and operator overloading to make your own arithmetics. Useful in DSL languages. With NumericLiterals, you can use any of Q, R, Z, I, N, G. Basic syntax: [Number][Letter] will forward the call to the type NumericLiteral[Letter] to FromInt32 [Number] (or FromInt64 or FromString...)
4 people like this
Posted: 29 days ago by Tuomas HietanenDSL for Price Patterns (Setup)
Domain-specific language for detecting patterns in stock prices. Run using try F#.
3 people like this
Posted: 27 days ago by Tomas PetricekDSL for Financial Contracts
Simple domain-specific language for modeling of financial contracts.
6 people like this
Posted: 27 days ago by Tomas PetricekDSL for Price Patterns (Demo)
Examples that use domain-specific langauge for detecting price patterns. To run the sample, load the previous snippet in TryF#. It opens the sample automatically.
2 people like this
Posted: 27 days ago by Tomas Petricek