Rants Tagged with “MGrammar”

1    (Total Pages: 1/Total Results: 5)

M Language Changes Coming in Next CTP

Oslo

If you haven't been following the new Specification for the M Language that the Oslo team has been cooking up, they have been making changes in response to feedback about the language.  These changes will come to light in the next CTP.  These changes are;

'=>' as label binding operator

The label binding operator has changed from '=' to '=>'.

@[] as escape for verbatim identifier names

Identifier names that need to be escaped use '@[]' instead of '[]'

'about' operator

about' is an operator that returns data for M identifiers (e.g., extents, type declarations, computed value declarations)

'item' removed

'item' is no longer a keyword used to iterate over a collection of collection of values. Instead, use 'value' to iterate over a collection, and 'value' plus parenthesis to iterate over a collection of collection.

'into' removed

'into' has been removed as a keyword with the 'join' and 'group by' query clauses.

'this' removed

'this' has been removed as a keyword that refers to all of the members of an entity type declaration. Instead, constraints now must be written after the member declarations and use 'value' to reference members.

Decimal without preceding 0

Decimals of the form '0.xxx' no longer require the preceding 0.

DateTimeOffset type and literal value added

A new data type, DateTimeOffset, has been added. In addition, a new literal kind, DateTimeOffset, has been added to write literals of the type DateTimeOffset

# undef removed

'#undef' has been removed from the supported set of preprocessor directives

Preprocessor scope changes

'#define' must occur before any conditional operator '#define' is scoped to a compilation unit, not a source file

Text patterns defined

Text value patterns are now defining including literals, character classes/ranges, repitition operators, 'any', 'empty' and 'error' keywords, and text pattern operators difference, intersect and inverse.

Productions defined

Productions are defining including pattern and token declarations, constructors, precedence rules, and constructor operators.

Rules defined

Rules are defining including token rules, syntax rules, interleave rules, and parameterized rules

Language defined

Language is defined

Binary literal syntax change

The literal syntax for binary has changed from \xNNNN to 0xNNNN.

binary shift operators removed

The binary shift operators (<< and >>) have been removed from the language.

Entity type computed value declarations removed

Entity types can no longer have computed value declarations

where/select become Where/Select

Where and Select query expression clauses now have the first character capitalized

Identity selector supports multiple fields

The identity selector now supports using more than 1 field as the identity to select an instance

extern

Extern is now supported for computed values and extent declarations

name overloaded changes

Now, within a module, computed values, extents and types must not have same names, where as before only computed values and extents could not have same names.

'.' leading dot identifier

A leading dot identifier '.' can be used to scope the remaining dotted identifiers to the current module rather than the current lexical scope

'::' scope identifier

The scope identifier '::' constructs a fully qualified identifier name with the module name to the left of the operator, and the module's member name to the right.

Attributes defined

Attributes as used by Mgrammar declarations is defined

Catalog definitions

The M catalog written in M is defined

SQL mapping

The M-to-SQL mapping is defined

Part 3 of My DSL for Developers Article is Live!

Oslo M

My third (and last) part of my series on building Textual DSLs is now live on the Oslo DevCenter. In this part, I discuss how to take the DSL and use it at runtime or insert it into a database. Using the Oslo Toolchain the whole way.

If you have a chance to read it, let me know what you think!

Textual DSLs for Developers Part 2 is Live!

MGrammar

The second of my three part series on convincing developers to build their own textual DSLs is up on the Oslo Dev Center. Take a look and don't forget the first in the series which you can find here:

http://msdn.microsoft.com/en-us/library/dd441702.aspx

 

Part 1 of My MGrammar-DSL Article is up!

Oslo

I am doing a three-part article for the Oslo DevCenter on building Domain Specific Languages with MGrammar. In this first part, I state the case for Domain Specific Languages. The article is based on my the CTP2 of Oslo that was recently released. Take a look and let me know what you think!

Using Classifications in MGrammar's Intellipad

Silverlight Logo

UPDATE: Added a couple of screenshots to clarify what the coloring does.

I am spending quite a bit of time this week writing my own MGrammar using the Oslo SDK. When writing a MGrammar, you can use something like attributes to help Intellipad know how to color your text to help make it more readable. For example,

@{CaseSensitive[false]}
language PricingLanguage

These attributes are used by different parts of the Oslo stack to hint the system with additional information (like Attritubes in .NET). The one that I was particularly interested in was the Classification attribute. This attribute allows you to tell IntelliPad how to format the part of the language. For example:

@{Classification["Comment"]}
token Comment = "//" ^("\r" | "\n")+;

The only two types of classifications that I could find or guess were seen in the PDC videos:  "Comment" and "Keyword". The MGrammar and IntelliPad docs didn't mention anything about classifications so I asked up on the Oslo Forums. While it isn't documented anywhere, I was told about a configuration file call ClassificationFormats.xcml that resides in the Settings folder of Intellipad (usually c:\Program Files\Microsoft Oslo SDK 1.0\Bin\IntelliPad\Settings). This lead me to two important pieces of information: a fuller list of classification types (i.e. Strings, Delimiter, Type, etc.) but also showed me how to customize the coloring as the default Intellipad coloring is starkly monochromatic. This file is a simple XAML file that contains individual classifications and how they are formatted:

<ls:ClassificationFormat Name='Keyword' 
                         FontSize='13' 
                         FontFamily='Consolas' 
                         Foreground='#FF333333' />

Each of these can be changed to specify the color (Foreground) and even the font and size (if you want unreadable code). You can edit this file and just use the Shift-Alt-F5 hotkey in Intellipad to reload the settings to tweak the colors as you like.

For example, I've edited the Keyword and Operator colors to show blue and red respectively. So that in my MGrammar if I use the Classification attribute to specify parts of my DSL are Keyword tokens or Operator tokens as shown here:

Then my language is colored based on my ClassificationFormats.xcml file:

Nice...