DSL++ Test Utility
===============================================================================================================
Author: John Smith, Version: 1.1
Description: Named as such because all languages are better with pluses
===============================================================================================================
[Multi-line enabled] Please add <newline> + '.' + <return> to the end of finished code to evaluate the result.
type Customer(name, loyaltyDiscount) { ... }
type OrderBase(customer, items) { ... }
type Product(name, price) { ... }
type OnlineOrder(customer, items, shippingCost) <- OrderBase {
func calculateTotal() {
// Calculate subtotal and apply loyalty discount
subtotal = calculateSubtotal();
loyaltyMultiplier = customer.getLoyaltyMultiplier();
return (subtotal * loyaltyMultiplier) + shippingCost;
}
func summary() {
// Build order summary
return 'Order for ' + customer.name +
' | Items: ' + items.length +
' | Total: ' + calculateTotal();
}
}
// Create some products
apple = new Product('Apple', 0.50);
coffee = new DiscountedProduct('Coffee Beans', 12.00, 10);
bread = new Product('Sourdough Bread', 3.20);
// Create a customer and place an order
customer = new Customer('Alice Johnson', 140);
order = new OnlineOrder(customer, [apple, coffee, bread], 2.99);
return order.summary();
.
> Result: Order for Alice Johnson | Items: 3 | Total: 16.77 (Type: String, Time taken: 24ms)
Create Languages Fast
Create your project, import the dependency and define your language. Still too slow? The sample starter project allows you to get a running start.
Building Blocks
LARF uses an object orientated approach to language development. All literal, operation or statement logic is contained within single classes.
Flexible Framework
It is completely customisable with the ability to override any property and component. Don't like the default parser? Write your own!