Project Description
TextFlow is a language-based workflow compiler and execution environment. It allows authors to create Windows Workflow-based executable programs using a language syntax as opposed to drag and drop in the WF designer.

The project consists of several parts: an authoring environment that displays workflow syntax as well as visual flowchart; a compiler to translate syntax to WF programs; a decompiler to translate from WF program to syntax; and an execution engine that provides all necessary runtime infrastructure.

The grammar that defines workflow syntax is built using ANTLR (www.antlr.org). It supports various control flow constructs such as conditional branching and looping, iteration, parallel execution, etc.

Here's a simple "Hello World" in TextFlow:

***********

WAITFOR 3 SECONDS // delay thrown in just for fun...

[
"Hello, World!" => Message // 'Message' DependencyProperty of custom activity bound to string

DisplayMessage // some custom activity that displays a message, somehow
]

***********

Noteworthy aspects of the codebase:

- demonstrates how to build workflows using the WF activity object model, including data binding
- demonstrates how to host the WF designer in a Windows Forms application
- demonstrates use of .NET 3.5 expression trees (http://msdn2.microsoft.com/en-us/library/bb397951.aspx) to compute conditional logic
- demonstrates how to implement a serialization surrogate (needed to allow WF infrastructure to serialize expression trees, which aren't inherently serializable)
- demonstrates use of Reflection.Emit APIs to dynamically generate Activity subclasses, including dynamic DependencyProperty creation (necessary to bind arbitrarily-typed inputs and outputs)

Constructive feedback welcome, and appreciated!

Enjoy!

Josh
www.joshlane.net/blog

Last edited Mar 1, 2008 at 2:08 AM by jplane, version 2