namespace SequenceTestNamespace
using System
using System.Collections.Generic
using System.Text
using System.IO
using BwBot.Runtime
using BwBot.Runtime.Tasks
class SequenceTest()
def Main(sequence-test)
{Console.WriteLine("a");}
sequence
{Console.WriteLine("1");}
{Console.WriteLine("2");}
{Console.WriteLine("3");}
{Console.WriteLine("b");}
sequence
{Console.WriteLine("1");}
{Console.WriteLine("2");}
{Console.WriteLine("3");}
{Console.WriteLine("c");}
sequence
{Console.WriteLine("1");}
{Console.WriteLine("2");}
{Console.WriteLine("3");}
sequence-test
Wednesday, December 9, 2009
Behavior Language WIP
Tuesday, June 16, 2009
Redo
I finally decided to go forward with a C# redo since the C++ version is too long and hard of a row to plow.
I've also cooked up a new syntax that is basically a prefix version of Python's syntax.
I've already written a simple tokenizer based on this article about regular expression parsing in C#. Another article that was helpful was Python: Myths about Indentation. That only took one day. The rest of the week was spent agonizing whether to have the parser just read the token list or convert to s-expressions and then parse.
I finally went back to an earlier idea of writing a class called TokenTree that extends List(object) where each element is either a token or a subtree. This should make things easier on the parsing end for various reasons. The s-expression idea was kind of neat but it seems redundant since I need AST classes anyways.
Later on I'll have to dump the RegEx stuff and write a more sophisticated tokenizer but at least this was a quick way to get started. For now I need to start writing the recursive descent parsing functions and the AST classes.
I've also cooked up a new syntax that is basically a prefix version of Python's syntax.
class Test():
def Foo1($x is foo): #forward chaining method
rule:
$x has $y
$y is bar
-->
$y is foo
I've already written a simple tokenizer based on this article about regular expression parsing in C#. Another article that was helpful was Python: Myths about Indentation. That only took one day. The rest of the week was spent agonizing whether to have the parser just read the token list or convert to s-expressions and then parse.
I finally went back to an earlier idea of writing a class called TokenTree that extends List(object) where each element is either a token or a subtree. This should make things easier on the parsing end for various reasons. The s-expression idea was kind of neat but it seems redundant since I need AST classes anyways.
Later on I'll have to dump the RegEx stuff and write a more sophisticated tokenizer but at least this was a quick way to get started. For now I need to start writing the recursive descent parsing functions and the AST classes.
Subscribe to:
Comments (Atom)