Geeks With Blogs
Jeff Ferguson Irritating other people since 1967 March 2009 Entries
Error 8013150A Importing TFS Work Item Templates with TFS Power Tools
I just ran across this error while using the Team Foundation Server Power Tools to import a work item template XML document into a TFS instance: Error 0x8013150A: An error relating to security occurred. So it’s a security issue, right? No. As it turns out, I had edited the XML file in Notepad and added values to a field definition with the ALLOWEDVALUES rule. In my over-zealous copy-and-paste efforts, I had added a few of the allowable values in more than one place: <FIELD reportable="dimension" ......

Posted On Monday, March 30, 2009 9:30 AM

Interpreting Mathematical Operators in MGrammar
Suppose that you have a need for a domain specific language that supports mathematical expressions. Specifically, you want to support the following: unsigned integers signed integers addition expressions subtraction expressions Your first attempt at such a grammar using MGrammar might look like this: module JeffFerguson.BlogPosts { language MathOps { // ignore whitespace syntax LF = "\u000A"; syntax CR = "\u000D"; syntax Space = "\u0020"; interleave Whitespace = LF | CR | Space; // operators token ......

Posted On Tuesday, March 24, 2009 9:23 AM

Defining String Literals in MGrammar
Consider a language authored in MGrammar that recognizes a keyword named “keyword” as well as string literals: module MyModule { language MyLanguage { // ignore whitespace syntax LF = "\u000A"; syntax CR = "\u000D"; syntax Space = "\u0020"; interleave Whitespace = LF | CR | Space; // string literals token Quote = "\""; token StringLiteral = Quote a:any* Quote => StringLiteral[a]; token Keyword = "keyword"; // statements token Semicolon = ";"; syntax Statement = s:(Keyword | StringLiteral) Semicolon ......

Posted On Saturday, March 21, 2009 7:03 PM

Making MGrammar Graph Traversal Easier
Do you enjoy writing the code to navigate graphs produced by MGrammar, looking for the nodes that you need? Neither do I. I have written a small helper class to make graph navigation just a little bit easier. The class, which I have called GraphNavigator, performs all of the navigation and calls delegates when interesting nodes are found. Here is an example usage: 1: GraphNavigator Nav = new GraphNavigator("Grammar.mgx", "JeffFerguson.Calculatix.Gr... 2: Nav.AddNodeProcessorDelegat... ......

Posted On Wednesday, March 18, 2009 8:06 AM

Adding Line Slopes and Print Statements to Calculatix Using MGrammar
I have added, thanks to MGrammar, a few new constructs to my fledgling Calculatix language: unary operators, used primarily so that I can specify negative whole numbers support for string literals the slopeof expression, allowing for the calculation of the slope of a line the show statement, allowing for the output of an expression’s value to the console This allows me to write input such as this: line LineA (4, -3) (2, 5); show "The slope of LineA is:"; show slopeof LineA; The MGrammar for this ......

Posted On Tuesday, March 17, 2009 11:40 AM

Processing MGrammar Graphs in C#
In this post, I began a discussion of a simple language defined in MGrammar that allows the specification of two-dimensional lines. Through this language, I can write input files that look like this: 1: line LineA (4,3) (2,5); 2: line LineB (5,6) (5,1); Now what? I’ve got a grammar, and an input language … but how is the input language processed? As it turns out, the abstract syntax tree (AST) graph that MGrammar generates from the input source can be read from a .NET language. In this post, I will ......

Posted On Monday, March 16, 2009 3:06 PM

Optimizing Parse Trees Through MGrammar Productions
In my last post, I presented a simple MGrammar definition for a specification of two-dimensional lines. My specification of a Point entity, which, in my language, looks like this: (4, 3) is implemented in MGrammar using the following specifications: // numbers token Digit = "0".."9"; token WholeNumber = Digit+; // points token XCoordinate = WholeNumber; token YCoordinate = WholeNumber; syntax Point = "(" x:XCoordinate "," y:YCoordinate ")" => Point[x,y]; What is the “=>” symbol, and what is ......

Posted On Sunday, March 15, 2009 5:21 PM

Defining Lines with MGrammar
Some of my previous posts have described a lexical analysis engine called Sotue. This work came from my passion for the business of parsing strings into contextual elements to be used in applications such as the language analysis phase of compilers. I have spent some time with the Jan 2009 CTP of Microsoft “Oslo”, and have found the MGrammar language construction technology particularly fascinating. I thought that I would take some time in blog entries describing my findings. I have a calculus book ......

Posted On Sunday, March 15, 2009 12:07 AM

Copyright © Jeff Ferguson | Powered by: