Luke Smith Write today, wrong tomorrow

Introducing Abaxus

Over the past month or so I've been working on a simple text parser library, called
Abaxus. The reason for this was that I was required to automatically generate an email
document from a template with a specific set of values inserted (date, names etc...).
I created a syntax based on the macro's from within Visual Studio for pre and post
build events. I have ported the original code from .NET v1.1 to .NET v2.0.

By adding attributes to your custom classes class, properties and methods and implementing
the IAbaxusClass interface you then register the object with the parser library, currently
working on a config file section for declaring the libraries to load. Methods and
properties and both known as Macros within Abaxus; MacroMethod and MacroProperty.

The Abaxus parser comes with several prebuilt classes within the Abaxus Library, which
wrap around the .NET classes;
Abaxus - Abaxus methods for accessing metadata about the abaxus macros (description
Math - Methods and properties for mathematical calculations
DateTime - Similar to the .NET DateTime class

As well as being able to access static methods and macros in a class that has been
registered (see above) it is also possible to access objects that have been coded
by the developer. Only variables that are of a type that implements the IAbaxusClass
interface can be registered with the parser and the object must be specifically registered
by the developer, meaning the script only has access to data within variables that
the developer allows.

I will work on more classes, adding to and refining the current ones, when I get time.

Example of the Abaxus Script

public class User : IAbaxusClass
public User()

public User(string name)
_firstName = name;

private string _firstName
public string FirstName
get { return _firstName;

public void Jump()



user = new User("Luke");

parser = new AbaxusParser();


text = "hello world $(DateTime.Today)
$(Abaxus.Description[Math.Div]) and tomorrow is $(DateTime.Now[+1]) or you could put
$(DateTime.Tomorrow) said $(*user.FirstName)"
string result = parser.Parse(text);

As you can see you can pass parameters to methods and formatting options to properties
(I will likely change the syntax to use "{}" to indicate formatting parameters so
results of methods can be formatted).

One thing to point out is the "$(*user.FirstName)" macro. The asterix indicates that the
content of the macro is a variable. The result of this macro returns the FirstName
of "Luke", which was assigned in the C# code. The next plan, after fixing a few things,
is to allow the script to create new instances of objects through the syntax "$(*bob=User["Luke"])"
and "$(*bob=*user), which will then be available throughout the lifetime of that script.

The binaries will hopefully be available by the end of the week (16th).

Any feedback on the project will be welcome.

comments powered by Disqus