Magic Cloud

An Open Source Application Generator


Magic Lambda Hyperlambda

This is the Hyperlambda parser and generator in Magic. More specifically, this project provides you with the following two slots.

Using these slots, you can both easily create, serialize, and parse Hyperlambda to lambda, and vice versa. Below is an example of parsing a piece of text as Hyperlambda, for then to dynamically execute it afterwards.

.hl:@"log.info:""This was logged from a piece of text"""
hyper2lambda:x:-
eval:x:-

You can also reverse the process, such as the following illustrates.

.hl
   log.info:This is some example logging invocation
lambda2hyper:x:-/*

The above two slots, allows you to dynamically generate plain text from a lambda structure, and vice versa, allowing you to for instance persist execution objects and structured data into files, your database, or for that matter transmit it over the network to another machine, etc. Below is an example of dynamically loading a Hyperlambda file from disc, for then to execute it. Notice, in order to have the following snippet work, you’ll need an actual file called “foo.hl” inside of your backend’s “files/” folder.

io.file.load:/foo.hl
hyper2lambda:x:-
eval:x:-/*

3 lines of code, allowing you to dynamically load and execute Hyperlambda, tied to your C# code dynamically, using ISlot implementations, and Super Signals. Not too bad for 3 lines of code …

Project website

The source code for this repository can be found at github.com/polterguy/magic.lambda.hyperlambda, and you can provide feedback, provide bug reports, etc at the same place.

Quality gates

License

This project is the copyright(c) 2020-2021 of Thomas Hansen thomas@servergardens.com, and is licensed under the terms of the LGPL version 3, as published by the Free Software Foundation. See the enclosed LICENSE file for details.