tags:

views:

66

answers:

1

I'm working on a DSL in Microsoft's new M Grammar, and it needs to allow decimal values. I've defined decimal as

token digits = "0".."9";
token spot = ".";
token decimal = digits+ | digits+ spot digits+ | spot digits+;

That seems to work, but is there a better way? It just feels like I'm missing something.

+1  A: 

After much digging I found that you can use the build in Language.Grammar.Decimal. As in

syntax Cost = Language.Grammar.Decimal

The Language.Base "namespace" also has some useful bits. Both Language.Base and Language.Grammar are built in to intellipad.

Mike Two