|
IronMeta
Version 3.0
|
IronMeta is available under the terms of the BSD License.
IronMeta was written entirely by Gordon Tisher.
Although the most common use for IronMeta is to build parsers on streams of text for use in compiling or other text processing, IronMeta can generate pattern matchers (more accurately, transducers) for any input and output type. You can use C# syntax directly in grammar rules to specify objects to match.
Current limitations:
3.0: April 9, 2013: VS 2012 and NuGet package.
2.3: February 27, 2012: Combining parsers.
char.2.2: February 21, 2012: Miscellaneous bug fixes.
2.1: July 1, 2011: Much refactoring, miscellaneous bug fixes.
IronMeta.Matcher.CharMatcher.Input() and IronMeta.Matcher.CharMatcher.Trimmed() for more convenient string handling.'a' {1, 3}).2.0: December 4, 2010: Many internal improvements.
1.4: July 18, 2009: Bug fixes and samples.
1.3: June 2, 2009: Optimization pass.
1.2: June 1, 2009: Bug fixes and miscellaneous enhancements.
1.1:
1.0: May 16, 2009: Initial release
IronMeta is built for .NET 4.5, and is distributed using NuGet. Open the Package Manager for a project in Visual Studio 2012 and search for IronMeta. Installing the package in your project will install the needed DLLs.
Once you have installed the NuGet package, add a file with the extension .ironmeta to your project. Visual Studio will automatically generate a C# grammar class for you and include it in your project. The generated parser class is declared as partial, so you can add ancillary code in another file if you wish.
In addition to the Visual Studio addin, the IronMeta executable is included in the tools directory of the NuGet package installation directory.
In order to use the IronMeta executable, run IronMeta.exe on your IronMeta file, which must have the extension .ironmeta. You can specify the following arguments to the program:
-f Force generation even if the input file is older than the output file.-n <namespace> Specify the namespace to use for the generated parser (defaults to the name of the directory the input file is in).-o <output> Specify the output file name (defaults to <input>.g.csIn order to use an IronMeta-generated parser in your C# program, do the following:
GetMatch() with the input you wish to parse, and the function of the generated parser class that corresponds to the top-level rule you wish to use. This returns an object of type IronMeta.Matcher.MatchResult, which contains information about the result of the match, as well as errors that might have ocurred.The following is a small sample program that uses the Calc The IronMeta Language demo parser that is included in the distribution.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyCalcProject
{
class Program
{
static void Main(string[] args)
{
var parser = new Calc();
var match = parser.GetMatch("2 * 7", parser.Expression);
if (match.Success)
Console.WriteLine("result: {0}", match.Result); // should print "14"
else
Console.WriteLine("error: {0}", match.Error); // shouldn't happen
}
}
}
There is a forum for asking questions about IronMeta at SourceForge.
If you come across a bug in IronMeta, please fill out a bug report at the SourceForge bug tracker.
In order to build IronMeta, you must download the source code using a Mercurial client:
hg clone http://hg.code.sf.net/p/ironmeta/code ironmeta
The Source folder of the source code contains a Visual Studio 2012 solution file called IronMeta.sln. This includes several projects:
If you would like to contribute to the development of IronMeta, please send patches or pull requests to the project admin listed at the SourceForge website or the IronMeta developers forum.
Copyright (C) 2009-2013 The IronMeta Project
1.7.6.1