Pseudo-Inherited Attributes in MGrammar (@November 2009 CTP)  

Saturday, December 26 2009

The M language and in particular MGrammar have caught my attention recently after completing Programming Languages and Translators this past semester at Columba. I didn’t take compilers as a part of my undergraduate studies at McGill and after completing Professor Aho’s course I am really intrigued by the possibilities offered by DSLs and DSVs.

After getting setup with .NET 4, the SQL Modelling November 2009 CTP, and Intellipad my first inclination was to see how I could implement some classic ideas in language theory with MGrammar. One such idea is “inherited attributes.” An inherited attribute is a value that is captured or calculated at a parent node in an abstract syntax tree and then passed down to child nodes for any calculations or translations that they may need to perform. A classic example of this would be the “with” keyword that is available in Javascript:


with (myObj) {
  x += 3;
  y += 3;
}

This would be equivalent to:


myObj.x += 3;
myObj.y += 3;

Let me know if you run into any issues with the behavior by emailing me: charlie [you know] robbins [obviously] gmail [you know] com. As always, all of this code is available under the MIT license on GitHub.


Read More...
  • Posted by Charlie Robbins

Adding ContactMultiTap to the Microsoft Surface  

Friday, December 25 2009

The Surface SDK comes in two flavors; WPF and XNA. All of the input events on the WPF Surface SDK are implemented as Attached Events, which are essentially just a clever use of standard Routed Events in WPF. I won’t delve into the all details here about what Attached Events are, but they were a primary focus for an implementation of ContactMultiTap on the Surface.

For those of you not familiar with the Surface, it’s convenient to think of it as a gigantic iPhone (although it’s been around in secret long before the iPhone) that can also recognize object tags (like 2D barcodes). This is because instead of using a capacitive multi-touch approach like the iPhone it implements a multi-camera computer vision system and interprets inputs from that. In this post, I discuss my implementation as well as the benefits of time-based multi-tap input on this “big a** table.”


Read More...
  • Posted by Charlie Robbins