DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Kotlin Code Style: Best Practices for Former Java Developers
  • Is Codex the End of Boilerplate Code?
  • Design Guards: The Missing Layer in Your Code Quality Strategy
  • Open Source: A Pathway To Personal and Professional Growth

Trending

  • Observability for Agents and Workflows: Tracing Prompts, Tool Calls, and Business Outcomes End-to-End
  • 11 Agentic Testing Tools to Know in 2026
  • WebSocket Debugging Without a Proxy — A Browser-First Workflow
  • How to Interpret the Number of Spring ApplicationContexts in Integration Tests
  1. DZone
  2. Coding
  3. Languages
  4. Lizzie, a Scripting Language for .NET

Lizzie, a Scripting Language for .NET

We take a look at an open source language that one developer has created, and how he hopes it can reduce compile times and learning curves for developers.

By 
Thomas Hansen user avatar
Thomas Hansen
DZone Core CORE ·
Aug. 28, 18 · Analysis
Likes (2)
Comment
Save
Tweet
Share
9.9K Views

Join the DZone community and get the full member experience.

Join For Free

Lizzie is a dynamically compiled scripting language for .NET, allowing you to incorporate dynamically loaded pieces of code into your C# and F# projects. One of its defining traits, is that, first of all, out of the box, it is literally theoretically impossible to execute malicious code, simply since out of the box, it doesn't contain a single piece of functionality that changes the state of your computer in any way. If you need such functions, which I assume most would, then creating such functions is as easy as marking your method with an attribute, and making sure it has the correct signature. Below is an example.

using System;
using lizzie;

class MainClass
{
    [Bind(Name = "write")]
    object Write(Binder<MainClass> binder, Arguments arguments)
    {
        Console.WriteLine(arguments.Get(0));
        return null;
    }

    public static void Main(string[] args)
    {
        // Some inline Lizzie code
        var code = @"

var(@foo, function({
  +(bar, ""world"")
}, @bar))

write(foo(""Hello ""))

";

        // Creating a Lizzie lambda object from the above code, and evaluating it
        var lambda = LambdaCompiler.Compile<MainClass>(new MainClass(), code);
        lambda();

        // Waiting for user input
        Console.Read();
    }
}

Notice how we "bind" a C# method in the above code to our Lizzie lambda object. This makes the C# method available as a "function" internally within our Lizzie code. This trait allows you to easily extend the language, with whatever domain specific extensions you need to solve your particular problem. This makes the language particularly well suited for "Domain Specific Languages."

In a way, Lizzie is Lisp, with JavaScript's syntax. This makes it blisterinly fast to compile a Lizzie snippet. In fact, there is an example over at its GitHub project page, where I compile a snippet of Lizzie code 10,000 times, and the entire process only takes about 2,200 milliseconds on my machine. So compiling Lizzie code is probably some 5-10 orders of magnitudes faster than compiling the equivalent C#, F#, or Boo code.

The language is extremely dynamic, has no type safety, and also executes fairly fast, since the end result is basically just a bunch of statically compiled delegates, chained together to create a lambda Func<object>, where each of its "branches" are simply CLR delegates. Since it's also extremely secure, unless you mindlessly extend it with suicidal methods, it's also a perfect fit for passing code over the network, to evaluate the code somewhere else than where it was created. In such a way, it's arguably to code what JSON is to data.

Due to the fact that its syntax resembles JavaScript, you should be able to use JavaScript syntax highlighters to edit code snippets, but (of course) without AutoCompletion, since its has different ways of declaring functions and variables.

You can find it in NuGet as "lizzie", or download its source code on GitHub, here. The entire code for Lizzie is roughly 2,000 lines, where probably 50% of the code is comments. The entire documentation for it is only 12 pages of print, allowing you to literally learn the language in 20 minutes. You can see a video demonstration of the language here. The language is open source and licensed under the terms of the MIT license.

Scripting language code style

Opinions expressed by DZone contributors are their own.

Related

  • Kotlin Code Style: Best Practices for Former Java Developers
  • Is Codex the End of Boilerplate Code?
  • Design Guards: The Missing Layer in Your Code Quality Strategy
  • Open Source: A Pathway To Personal and Professional Growth

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook