Geeks With Blogs

News
CloudCasts Blog Webcasts in the Cloud
I never really “got” the idea of the need to build a textual DSL when I was first introduced to MGrammar. The light really switched on when I looked into developing a DSL that would make it easier for developers to create BAM activities.
The BAML language only took a couple of hours to develop. I had experimented with simple text based DSLs before, so this was my first “real” language.
I have recorded a 20 minute webcast showing how the language works, and how it can be used. If you want to experiment with it yourself, the language is here.
module BloggersGuides
{
    language BAML
    {
        syntax Main = Activity;
       
        syntax Activity =
        ActivityToken
        n:NameToken
        '{'
            p:List(PKI)
        '}'
            => { activity { n,{ p }} };
           
           
        syntax PKI = Milestone | Integer | Decimal | Text;
           
           
        syntax Milestone = t:MilestoneToken n:NameToken ';'
            => { t, { n } };
           
        syntax Integer = t:IntegerToken n:NameToken ';'
            => { t, { n } };
           
        syntax Decimal = t:DecimalToken n:NameToken ';'
            => { t, { n } };
           
        syntax Text = t:TextToken n:NameToken ';'
            => { t, { n } };
           
        syntax List (Element) =
            e:Element => { e } |
            list:List(Element) e:Element => { valuesof(list), e };
       
       
        token NameToken = ('A'..'Z' | 'a'..'z')+;
       
        @{ Classification ["Keyword"] }
        token ActivityToken = "activity";
       
        @{ Classification ["Keyword"] }
        token MilestoneToken = "milestone";
       
        @{ Classification ["Keyword"] }
        token IntegerToken = "integer";
       
        @{ Classification ["Keyword"] }
        token DecimalToken = "dec";
       
        @{ Classification ["Keyword"] }
        token TextToken = "text";
       
        interleave Whitespace = ' ' | '\r' | '\n' | '\t';
    }
}
 
This is the sample input file I used on the webcast.
activity ConferenceBooking
{
    milestone BookingDate;
    text ConferenceName;
    text AttendeeCity;
    text HotelName;
    dec Price;
    integer Days;
}
 
You will need the command line compiler to get the BAM activity created, if you contact me I can email it to you.
Regards,
Alan
Posted on Thursday, April 30, 2009 4:49 PM Oslo , BizTalk | Back to top


Comments on this post: Webcast – BAML – A DSL for BAM

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Alan Smith | Powered by: GeeksWithBlogs.net