Saturday, May 9, 2009

Axum Hello World

So, I'm no Axum expert, but I feel like one today. I just wrote an incredible little application that says Hi to me. I think I can quit for the day. I have succeeded. I feel accomplished.



using System;
using System.Concurrency;
using Microsoft.Axum;

namespace HelloWorld
{
public domain Program
{
private writer agent MainAgent : channel Microsoft.Axum.Application
{
public MainAgent()
{
String [] args = receive(PrimaryChannel::CommandLine);

var hello = AgentHello.CreateInNewDomain();

hello::Name <-- "David";
var msg = receive(hello::Message);

Console.WriteLine(msg);
Console.ReadLine();
// TODO: Add work of the agent here.

PrimaryChannel::Done <-- Signal.Value;
}

}

channel ChannelHello
{
input string Name;
output string Message;

Start: { Name -> S1; }
S1: { Message -> End; }
}

agent AgentHello : channel ChannelHello
{
public AgentHello()
{
var name = receive(Name);
var message = "Hello " + name;
Message <-- message;

}
}
}
}