<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>ometasharp Forum Rss Feed</title><link>http://www.codeplex.com/ometasharp/Thread/List.aspx</link><description>ometasharp Forum Rss Description</description><item><title>New Post: Blowing my mind...</title><link>http://ometasharp.codeplex.com/Thread/View.aspx?ThreadId=74708</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Wow, thanks for the response. You've given me a lot to read and think about. I'll have to read about it more and decide whether or not to go the route of creating a new parser. Your words are encouraging however, which is dangerous because I think I'm starting to talk myself into it despite the time I know it will take.&lt;/p&gt;
&lt;p&gt;I will have to look at your source code more closely as well.&lt;/p&gt;&lt;/div&gt;</description><author>justinc</author><pubDate>Wed, 11 Nov 2009 03:38:39 GMT</pubDate><guid isPermaLink="false">New Post: Blowing my mind... 20091111033839A</guid></item><item><title>New Post: Blowing my mind...</title><link>http://ometasharp.codeplex.com/Thread/View.aspx?ThreadId=74708</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi Justin,&lt;/p&gt;
&lt;p&gt;When MGrammar was released a few weeks or so after I started OMeta#, I decided to stop work on it and I moved on to other things. The reason is that the language is the easy part and tool support becomes the hard part. This was just too much to do well on my own in my spare cycles. My hope was that MGrammar would get mainstream support for DSLs. I was willing to let some of OMeta's features go in exchange for Microsoft backing something similiar.&lt;/p&gt;
&lt;p&gt;It's sort of sad to hear where Oslo is going. MGrammar had far greater potential than just being SQL Server specific.&lt;/p&gt;
&lt;p&gt;I haven't been in the OMeta# code for over a year, but I'd like to point out a few things based off your questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The DLR and C# 4.0 wasn't realistically available for use when I wrote OMeta# initially. The use of these (especially C# 4.0's &amp;quot;dynamic&amp;quot; feature) would make the code simpler. It'd probably be best to mostly start over from scratch. You could be up and running in not too much time.&lt;/li&gt;
&lt;li&gt;As mentioned in my initial &lt;a href="http://www.moserware.com/2008/06/ometa-who-what-when-where-why.html"&gt;blog post&lt;/a&gt;, OMeta handles streams of *anything* and does pattern matching on it. Streams of characters is just one kind. Note that &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#360102"&gt;optimizer&lt;/a&gt;&amp;nbsp;is written in OMeta#. In that case, the input and output are a simplified AST. in this case, &amp;quot;&lt;span&gt;ometa OMetaOptimizer&amp;lt;HostExpression&amp;gt; : Parser&amp;lt;HostExpression&amp;gt;&amp;quot; means that it is taking in (and producing) HostExpression(s) which you can think of as LISP cons cells (more details &lt;a href="http://www.moserware.com/2008/07/building-object-oriented-parasitic.html"&gt;here&lt;/a&gt;). You could easily (in theory) write generators for any language from these. I&amp;nbsp;picked C# and wrote a HostExpression/AST -&amp;gt; C# &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#360104"&gt;translator&lt;/a&gt;&amp;nbsp;as an example. Note that this is done without needing explicit &amp;quot;visit&amp;quot;s as would be the case in a Visitor pattern implementation. See Alex's &lt;a href="http://www.vpri.org/pdf/tr2008003_experimenting.pdf"&gt;thesis&lt;/a&gt;&amp;nbsp;for more details on why OMeta eliminates the need for a specialized Visitor pattern and does everything with a super pattern-matching concept.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;As for your &amp;quot;sum&amp;quot; question, check out the &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#360156"&gt;Calculator example&lt;/a&gt;. In that case I do it two different ways. The first evaluates it directly:&lt;br&gt;AddExpr &amp;nbsp;= AddExpr:x '+' MulExpr:y &amp;nbsp;-&amp;gt; { x + y }&lt;br&gt;&lt;br&gt;Here you see the result of matching AddExpr will be an Int32 and it'll be bound to &amp;quot;x&amp;quot;&amp;nbsp; (the right hand side of a -&amp;gt; is what the pattern matches. The beauty of OMeta is that you can then use it directly in the semantic action. In fact, the &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#360103"&gt;OMeta parser itself is written in OMeta&lt;/a&gt; (that takes characters and produces an AST)&lt;br&gt;&lt;br&gt;This is the case if you're taking in text and producing a value. The other approach is to create a AST like you are doing in your M example. I do this in the &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#360684"&gt;Calculator Parser example&lt;/a&gt;:&lt;br&gt;AddExpr &amp;nbsp;= AddExpr:x '+' MulExpr:y &amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;gt; { &amp;quot;add&amp;quot;, x, y }&lt;br&gt;&lt;br&gt;This is more or less exactly what you're doing in your example&amp;nbsp;(the result is just a tuple/list/cons cell)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;Grammar re-use is a huge concept in OMeta. You can extend other grammars or use the &amp;quot;foreign&amp;quot; keyword to &amp;quot;lend&amp;quot; your stream to another grammar. This makes it easy to build language mashups.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;I put OMeta# under a very permissive license. If you read the my posts and Alex's thesis, you can go a long way and quickly surpass what I did here. One approach you could take is to rewrite the core of OMeta in C# 4.0 and use that as a basis for your MetaSharp. Altenatively, I can give you commit access here and you could have MetaSharp reference it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Does that help clarify things? &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><author>jeffmoser</author><pubDate>Wed, 11 Nov 2009 03:10:39 GMT</pubDate><guid isPermaLink="false">New Post: Blowing my mind... 20091111031039A</guid></item><item><title>New Post: Blowing my mind...</title><link>http://ometasharp.codeplex.com/Thread/View.aspx?ThreadId=74708</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Ok I have to be honest. I was just reading Douglas Purdy's latest blog post (&lt;a href="http://www.douglaspurdy.com/2009/11/10/from-oslo-to-sql-server-modeling/"&gt;http://www.douglaspurdy.com/2009/11/10/from-oslo-to-sql-server-modeling/&lt;/a&gt;) about project &amp;quot;Oslo&amp;quot; and feeling very afraid that MGrammar wasn't going to turn out like I hoped. Probably mired in licensing or lost in some sql server modeling behemoth. That's ok I guess but now I am out looking for a replacement and I was doing so with low expectations.&amp;nbsp;But here I find OMeta#, it looks different enough from MGrammar but also strikingly similar... :)&lt;/p&gt;
&lt;p&gt;I'll try to give you a little background on where I'm coming from and then ask some questions, some MGrammar comparisons some just for my own understanding of OMeta#.&lt;/p&gt;
&lt;p&gt;First off, I'm working on a related project here on codeplex called MetaSharp (&lt;a href="http://metasharp.codeplex.com"&gt;http://metasharp.codeplex.com&lt;/a&gt;). Sorry for the similar name, it was an accident but don't be threatened! It's actually very &lt;em&gt;complimentary &lt;/em&gt;rather than competitive. So far I've been using MGrammar to do all of my parsing and grammar authoring then everything that MetaSharp is concerned with is the before and after the actual parsing. In short it's a transformation engine. Transforming text into an AST is just one of those steps. This is what I would like to get out of OMeta#. I would like a way to parse arbitrary text and result in a tree of Nodes. The theory is, with standard AST nodes for common programming constructs you can build transformers to convert that AST into anything else (such as CodeDom objects or Linq Expressions or text etc.). The goal here is to enable arbitrary DSLs and scripting languages and, frankly, any type of language oriented tool.&lt;/p&gt;
&lt;p&gt;So I have a few questions, I was poking around in the source code here (for example &lt;a href="http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#361393"&gt;http://ometasharp.codeplex.com/SourceControl/changeset/view/17706#361393&lt;/a&gt;) and I see that your right hand projections appear to be arbitrary code (C# even?). So it seems that OMeta# merely generates code that matches patterns based on the left hand side DSL then generates the code on the right hand side? Plus the &amp;quot;ometa&amp;quot; keyword generates some type of specialized class? So what I see here is that you're generating an html string, so I'm assuming the Parser&amp;lt;char&amp;gt; indicates that the output of this parser is a stream of chars, otherwise known as a string? So If I changed this to Parser&amp;lt;Node&amp;gt; could I potentially create a sytnax such as:&lt;/p&gt;
&lt;p&gt;Example -&amp;gt; { Push(new ExampleNode())&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Additionally I see some things in your code such as:&lt;/p&gt;
&lt;p&gt;InputDecl -&amp;gt; { CodeGen.Create()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Write(&amp;quot;(&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Write(&amp;quot;OMetaStream&amp;lt;&amp;quot;, Get&amp;lt;string&amp;gt;(&amp;quot;CodeType&amp;quot;), &amp;quot;&amp;gt; &amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteLeveledVar(&amp;quot;inputStream&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Write(&amp;quot;, out OMetaList&amp;lt;HostExpression&amp;gt; &amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteLeveledVar(&amp;quot;result&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Write(&amp;quot;, out OMetaStream &amp;lt;&amp;quot;, Get&amp;lt;string&amp;gt;(&amp;quot;CodeType&amp;quot;), &amp;quot;&amp;gt; &amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteLeveledVar(&amp;quot;modifiedStream&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.WriteLineEnd(&amp;quot;)&amp;quot;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;},&lt;/p&gt;
&lt;p&gt;Which actually concerns me a little, it goes a little counter to my reasoning. So for this question I just want to tell you what I feel is wrong with this, how I have tried to solve it with MetaSharp and I would basically just like to hear what you think about it.&lt;/p&gt;
&lt;p&gt;What looks like is happening here is that you're doing a textual transformation directly inside of your grammar. To me the problem with this is that you end up with a grammar that is only good for one thing (and is kind of ugly). Ideally, I think you should generate AST nodes then use visitors to generate this text instead. The &amp;nbsp;reason why I suggest this is because, to me, that makes the grammar more &amp;quot;pure&amp;quot; for one thing (it would be akin to separating a view from logic) and also it would allow you to write multiple transformers, so you could generate C# today and VB tomorrow for example. You could also push it through multiple transformation steps and you could also allow plugins to modify the AST (aspects?) etc. To me what would be much more valuable instead of arbitrary code on the right hand side is an AST declaration syntax, this was one thing that MGrammar did very well. I could be satisfied with the Parser&amp;lt;Node&amp;gt; described above though.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next, suppose I wanted to define code to parse &amp;quot;sum(x, y)&amp;quot;. How would I do this in OMeta#? Here it is in MGrammar you should be able to understand what I'm saying here.&lt;/p&gt;
&lt;p&gt;sytnax sum = &amp;quot;sum(&amp;quot; a:Join(Identifier, &amp;quot;,&amp;quot;) &amp;quot;)&amp;quot; =&amp;gt; MethodInvocationExpression { Name =&amp;gt; &amp;quot;sum&amp;quot;, Arguments =&amp;gt; a };&lt;/p&gt;
&lt;p&gt;syntax Join(a, b)&amp;nbsp;= a =&amp;gt; [a] | a b c:Join(a) =&amp;gt; [a, valuesof(c)];&lt;/p&gt;
&lt;p&gt;[...] implies a collection of results, &amp;quot;valuesof&amp;quot; in this context simply flattens the collection so you don't have a bunch of nested items.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, what sort of support do you have for grammar reuse? In addtion to AST reuse I want to promote Grammar reuse. Specifically, in an external DSL, it's really common to write something very declarative but then add some support for BinaryExpressions or other common general purpose language constructs. And it turns out that BinaryExpressions are really hard! I would love it if, when writing a new DSL, I could start from a place where I could pull in common things such as binary expressions or if / else statements etc. without &lt;em&gt;having &lt;/em&gt;to use everything else too (opt in). Also, are there any namespacing/import grouping mechanisms for your grammars?&lt;/p&gt;
&lt;p&gt;I have more but I'll try to pace myself for now. This is exciting!&lt;/p&gt;&lt;/div&gt;</description><author>justinc</author><pubDate>Tue, 10 Nov 2009 21:30:22 GMT</pubDate><guid isPermaLink="false">New Post: Blowing my mind... 20091110093022P</guid></item><item><title>New Post: Brain dump</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36613</link><description>&lt;div style="line-height: normal;"&gt;Thanks for the update Nick! (as well as the praise for OMeta. Alex and friends have made a very interesting language)&lt;br&gt;
&lt;br&gt;
I agree that negative matches are confusing at first. The trick to realize is that &amp;quot;~SomeRule&amp;quot; does not, as&amp;nbsp;commonsense might first lead you to believe, match any rule but &amp;quot;SomeRule.&amp;quot; To understand the core of language on this point, you need to look at what &amp;quot;~~SomeRule&amp;quot; means. A &amp;quot;~~&amp;quot; or &amp;quot;not not&amp;quot; means a &amp;quot;lookahead&amp;quot; assertion (see the original OMeta paper for more on this). Thus, &amp;quot;~~SomeRule&amp;quot; means &amp;quot;verify that the SomeRule is what follows, but don't actually consume the input. Likewise, &amp;quot;~SomeRule&amp;quot; means &amp;quot;verify that SomeRule is not what follows&amp;quot;, but don't actually consume any input.&lt;br&gt;
&lt;br&gt;
You've keyed in on a big design issue when you discuss lists and strings. It is quite confusing. The pain you experience is my possibly poor decision to make a list of characters and a string to be roughly equivalent in OMeta# just like they are in OMeta/JS. At first, I forced grammar writers to say &amp;quot;Sugar.Implode(listName)&amp;quot; to take a character list and convert it to a string, but then I decided this was the common case, so I made it automatic. I can revisit this decision if it's causing problems that can't be worked around. Let me know specifics if you get stuck.&lt;br&gt;
&lt;br&gt;
I don't think that moving to XML would necessarily make things easier. OMetaList is fairly flexible as a&amp;nbsp;recursive data structure if you need it. It's the data structure that the optimizer uses to optimize parsed OMeta/C# code. &lt;br&gt;
&lt;br&gt;
Let me know what you would find helpful in a &amp;quot;quick reference&amp;quot; or ideas for future example programs and I'd be happy to work on those if that'd be helpful.&lt;br&gt;
&lt;br&gt;
Keep up the great work and questions!&lt;br&gt;
&lt;br&gt;
Jeff&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;</description><author>jeffmoser</author><pubDate>Sun, 28 Sep 2008 19:39:21 GMT</pubDate><guid isPermaLink="false">New Post: Brain dump 20080928073921P</guid></item><item><title>New Post: Brain dump</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36613</link><description>&lt;div style="line-height: normal;"&gt;Some thoughts after spending a bit more recreational time with OMeta#...$0$0$0$0It is easier to build a parser with OMeta than anything I've attempted to use before - unambiguous, contextual matching is so nice!$0$0$0$0$0OMeta# is getting easier to use. It will be a lot more approachable with some better support for error messages, and a syntax &amp;quot;quick reference&amp;quot; but these things take work I know... All in good time :)$0$0$0$0$0The biggest points of confusion for me so far have been:$0$0$0$0Negative matches - ~blah just doesn't seem to work for me :($0$0Confusion between 'strings' and 'lists' - i.e. Foo+:f ends up spitting out a list, rather than a string of n Foos - yet trying to manipulate f in the transformation section to create a string gives me errors because it is cast in the generated code to a string :) - the result is output that looks like [h, e, l, l, o]$0$0$0I think perhaps looking back I would have been better off not specifying that the Markup grammar produces a string, and instead perhaps transformed to a nested XmlNode structure of some kind? Need to experiment some more - living and learning.$0$0$0$0$0Sure I'll work my way through some of this. Just thought I'd post an update. Cheers!$0$0&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Sun, 28 Sep 2008 18:19:29 GMT</pubDate><guid isPermaLink="false">New Post: Brain dump 20080928061929P</guid></item><item><title>New Post: Newbie syntax questions</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36146</link><description>&lt;div style="line-height: normal;"&gt;&lt;div dir=ltr&gt;&lt;div&gt;Jeff - thanks for clearing that up! Answers everything perfectly.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I will let you know how I go extending the sample.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Nick&lt;br&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;On Mon, Sep 22, 2008 at 5:11 PM, jeffmoser &lt;span dir=ltr&gt;&amp;lt;&lt;a href="mailto:notifications@codeplex.com"&gt;notifications@codeplex.com&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:#ccc 1px solid"&gt;
&lt;div&gt;
&lt;p&gt;From: jeffmoser&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;It's great to see you &amp;quot;getting your hands dirty&amp;quot; with OMeta#!&lt;br&gt;&lt;br&gt;One thing that's subtle with OMeta's syntax is that &amp;quot;sample&amp;quot; in double quotes applies the **Token** rule that is defined in runtime's &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360085&amp;changeSetId=17706"&gt;Parser&lt;/a&gt; with the given argument of whatever is inside the quotes (see the SCharacters rule in &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360103&amp;changeSetId=17706"&gt;OMetaParser.ometacs&lt;/a&gt;). The token rule allows for an arbitrary number of Space(s) to precede it. If you look at the Space rule that is defined in &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360077&amp;changeSetId=17706"&gt;OMeta.cs&lt;/a&gt;, you'll see that it will match whatever &lt;a href="http://msdn.microsoft.com/en-us/library/system.char.iswhitespace.aspx"&gt;Char.IsWhitespace&lt;/a&gt; deems as whitespace (which includes newlines '\n'). This is one thing that was causing you grief. '\n' matches the literal new line rather than the token newline. The difference is that with the default Space rule, &amp;quot;\n&amp;quot; will never match because it already matches an arbitrary number of whitespace (that includes '\n') before it.&lt;br&gt;
&lt;br&gt;Also, note that &amp;quot;:h&amp;quot; by itself is an abbreviation for &amp;quot;Anything:h&amp;quot; which consumes one item of input from the input stream, which in this case is a single character. This doesn't appear to be what you wanted.&lt;br&gt;
&lt;br&gt;Other than these small issues, everything else looked pretty good. I took advantage of OMeta's quantifying operators (* and + which mean &amp;quot;zero or more&amp;quot; and &amp;quot;one or more&amp;quot; respectively) to simplify things down a bit. I also changed your HDelim rule to be slightly more general.&lt;/p&gt;

&lt;p&gt;The result is a new &amp;quot;&lt;a href="http://www.codeplex.com/ometasharp/SourceControl/DirectoryView.aspx?SourcePath=$/ometasharp/trunk/Examples/Markup/Markup&amp;changeSetId=17706"&gt;Markup&lt;/a&gt;&amp;quot; example project in the latest check-in. The grammar file is located &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=361393&amp;changeSetId=17706"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;Does this answer your question?&lt;/p&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;Read the &lt;a href="http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36146&amp;ANCHOR#Post120220"&gt;full discussion online&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To add a post to this discussion, reply to this email (&lt;a href="mailto:ometasharp@discussions.codeplex.com?subject=[ometasharp:36146]"&gt;ometasharp@discussions.codeplex.com&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;To start a new discussion for this project, email &lt;a href="mailto:ometasharp@discussions.codeplex.com"&gt;ometasharp@discussions.codeplex.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You are receiving this email because you subscribed to this discussion on CodePlex. You can &lt;a href="http://www.codeplex.com/site/discussions/project/unsubscribe/ometasharp"&gt;unsubscribe or change your settings&lt;/a&gt; on codePlex.com.&lt;/p&gt;

&lt;p&gt;Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at &lt;a href="http://codeplex.com/"&gt;codeplex.com&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Tue, 23 Sep 2008 00:48:52 GMT</pubDate><guid isPermaLink="false">New Post: Newbie syntax questions 20080923124852A</guid></item><item><title>New Post: Newbie syntax questions</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36146</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;It's great to see you &amp;quot;getting your hands dirty&amp;quot; with OMeta#!&lt;br&gt;
&lt;br&gt;
One thing that's subtle with OMeta's syntax is that &amp;quot;sample&amp;quot; in double quotes applies the **Token** rule that is defined in runtime's&amp;nbsp;&lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360085&amp;changeSetId=17706"&gt;Parser&lt;/a&gt; with the given argument of whatever is inside the quotes (see the SCharacters rule in &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360103&amp;changeSetId=17706"&gt;OMetaParser.ometacs&lt;/a&gt;). The token rule allows for an arbitrary number of Space(s) to precede it. If you look at the Space rule that is defined in &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=360077&amp;changeSetId=17706"&gt;OMeta.cs&lt;/a&gt;, you'll see that it will match whatever&amp;nbsp;&lt;a href="http://msdn.microsoft.com/en-us/library/system.char.iswhitespace.aspx"&gt;Char.IsWhitespace&lt;/a&gt; deems as whitespace (which includes newlines '\n'). This is one thing that was causing you grief. '\n' matches the literal new line rather than the token newline. The difference is that with the default Space rule, &amp;quot;\n&amp;quot; will never match because it already matches an arbitrary number of whitespace (that includes '\n') before it.&lt;br&gt;
&lt;br&gt;
Also, note that &amp;quot;:h&amp;quot; by itself is an abbreviation for &amp;quot;Anything:h&amp;quot; which consumes one item of input from the input stream, which in this case is a single character. This doesn't appear to be what you wanted.&lt;br&gt;
&lt;br&gt;
Other than these small issues, everything else looked pretty good. I took advantage of OMeta's quantifying operators (* and + which mean &amp;quot;zero or more&amp;quot; and &amp;quot;one or more&amp;quot; respectively) to simplify things down a bit. I also changed your HDelim rule to be slightly more general.&lt;/p&gt;
&lt;p&gt;The result is a new &amp;quot;&lt;a href="http://www.codeplex.com/ometasharp/SourceControl/DirectoryView.aspx?SourcePath=$/ometasharp/trunk/Examples/Markup/Markup&amp;changeSetId=17706"&gt;Markup&lt;/a&gt;&amp;quot; example project in the latest check-in. The grammar file is located &lt;a href="http://www.codeplex.com/ometasharp/SourceControl/FileView.aspx?itemId=361393&amp;changeSetId=17706"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Does this answer your question?&lt;/p&gt;
&lt;/div&gt;</description><author>jeffmoser</author><pubDate>Tue, 23 Sep 2008 00:10:55 GMT</pubDate><guid isPermaLink="false">New Post: Newbie syntax questions 20080923121055A</guid></item><item><title>New Post: Newbie syntax questions</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36146</link><description>&lt;div style="line-height: normal;"&gt;.. this time hopefully not corrupted:&lt;br&gt;
&lt;br&gt;
&lt;span style="font-size:13px"&gt;
&lt;p&gt;ometa OMetaSharp.Examples.LittleTypeChecker&amp;lt;char, string&amp;gt; : Parser&amp;lt;char&amp;gt; {&lt;/p&gt;
&lt;p&gt;TypeCheck = Body:t End -&amp;gt; { &amp;quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot; },&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Body = Block:p Body:b -&amp;gt; { p + b }&lt;/p&gt;
&lt;p&gt;| Block,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Block = Heading | Para,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Heading = HDelim:h Text:t :h NewLine&lt;/p&gt;
&lt;p&gt;-&amp;gt; { &amp;quot;&amp;lt;&amp;quot; + h + &amp;quot;&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/&amp;quot; + h + &amp;quot;&amp;gt;&amp;quot; },&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;HDelim = &amp;quot;===&amp;quot; -&amp;gt; { &amp;quot;h3&amp;quot; }&lt;/p&gt;
&lt;p&gt;| &amp;quot;==&amp;quot; -&amp;gt; { &amp;quot;h2&amp;quot; }&lt;/p&gt;
&lt;p&gt;| &amp;quot;=&amp;quot; -&amp;gt; { &amp;quot;h1&amp;quot; },&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Para = Text:t -&amp;gt; { &amp;quot;&amp;lt;p&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/p&amp;gt;&amp;quot; },&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Text = Item:i Text:t -&amp;gt; { i + t }&lt;/p&gt;
&lt;p&gt;| Item,&lt;/p&gt;
&lt;p&gt;Item = LetterOrDigit&lt;/p&gt;
&lt;p&gt;| SpaceOrMore -&amp;gt; { &amp;quot; &amp;quot; },&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;SpaceOrMore = Space Spaces,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NewLine = &amp;quot;\n&amp;quot;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/span&gt;
&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Mon, 22 Sep 2008 00:47:29 GMT</pubDate><guid isPermaLink="false">New Post: Newbie syntax questions 20080922124729A</guid></item><item><title>New Post: Newbie syntax questions</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36146</link><description>&lt;div style="line-height: normal;"&gt;Hi,$0$0$0$0I've been trying to do a simple text transformation along the lines of the Google Code wiki markup.$0$0$0$0$0The small chunk I've been implementing matches text, which are transformed to HTML paragraphs, and headings in the form:$0$0$0$0$0= This is a Heading =$0$0$0$0$0...which are transformed into HTML headings. The number of '=' signs denote a heading level H1 to H3.$0$0$0$0$0The complete (broken) grammar is below. The two points I'm having trouble with are:$0$0$0$0$01. Matching newlines$0$0$0$0$0No matter where I put it, &amp;quot;\n&amp;quot; causes an error when running the generated parser.$0$0$0$0$02. Named matches emit as raw text, not transformed, when appearing more than once in the same rule$0$0$0$0$0I.e. see the HDelim rule below, that I believe should transform the equals signs into an appropriate HTML tag name. When :h appears later in the rule, the raw source text is emitted.$0$0$0$0$0You can paste the grammar into the Little Typechecker example if you want to give it a run - grammar and expression names are unchanged :)$0$0$0$0$0Any advice on where I'm going wrong greatly appreciated.$0$0$0$0$0Nick$0$0$0$0$0--$0$0$0$0$0$0ometa OMetaSharp.Examples.LittleTypeChecker&amp;lt;char, string&amp;gt; : Parser&amp;lt;char&amp;gt; {$0$0$0$0$0    TypeCheck = Body:t End&lt;span style="white-space:pre"&gt;		&lt;/span&gt;-&amp;gt; { &amp;quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot; },$0$0    $0$0    Body = Block:p Body:b&lt;span style="white-space:pre"&gt;		&lt;/span&gt;-&amp;gt; { p + b }$0$0&lt;span style="white-space:pre"&gt;			&lt;/span&gt;| Block,$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;Block = Heading | Para,$0$0    $0$0    Heading = HDelim:h Text:t :h NewLine$0$0&lt;span style="white-space:pre"&gt;								&lt;/span&gt;-&amp;gt; { &amp;quot;&amp;lt;&amp;quot; + h + &amp;quot;&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/&amp;quot; + h + &amp;quot;&amp;gt;&amp;quot; },$0$0    $0$0    HDelim = &amp;quot;===&amp;quot; -&amp;gt; { &amp;quot;h3&amp;quot; }$0$0&lt;span style="white-space:pre"&gt;		&lt;/span&gt;| &amp;quot;==&amp;quot; -&amp;gt; { &amp;quot;h2&amp;quot; }$0$0&lt;span style="white-space:pre"&gt;		&lt;/span&gt;| &amp;quot;=&amp;quot; -&amp;gt; { &amp;quot;h1&amp;quot; },$0$0    $0$0    Para = Text:t&lt;span style="white-space:pre"&gt;				&lt;/span&gt;-&amp;gt; { &amp;quot;&amp;lt;p&amp;gt;&amp;quot; + t + &amp;quot;&amp;lt;/p&amp;gt;&amp;quot; },$0$0    $0$0    Text = Item:i Text:t &lt;span style="white-space:pre"&gt;		&lt;/span&gt;-&amp;gt; { i + t }$0$0&lt;span style="white-space:pre"&gt;			&lt;/span&gt;| Item,$0$0$0$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;Item =&lt;span style="white-space:pre"&gt;	&lt;/span&gt;LetterOrDigit$0$0&lt;span style="white-space:pre"&gt;			&lt;/span&gt;| SpaceOrMore&lt;span style="white-space:pre"&gt;		&lt;/span&gt;-&amp;gt; { &amp;quot; &amp;quot; },$0$0&lt;span style="white-space:pre"&gt;			&lt;/span&gt;$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;SpaceOrMore = Space Spaces,$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;$0$0&lt;span style="white-space:pre"&gt;	&lt;/span&gt;NewLine = &amp;quot;\n&amp;quot;$0$0}$0$0$0$0$0&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Mon, 22 Sep 2008 00:46:20 GMT</pubDate><guid isPermaLink="false">New Post: Newbie syntax questions 20080922124620A</guid></item><item><title>New Post: Regenerating parsers</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36138</link><description>&lt;div style="line-height: normal;"&gt;&lt;div dir=ltr&gt;That did the trick. Thanks!&lt;br&gt;&lt;br&gt;&lt;div&gt;On Sun, Sep 21, 2008 at 2:53 PM, jeffmoser &lt;span dir=ltr&gt;&amp;lt;&lt;a href="mailto:notifications@codeplex.com"&gt;notifications@codeplex.com&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"&gt;   &lt;div&gt; &lt;p&gt;From: jeffmoser&lt;/p&gt; &lt;div&gt;You should be able to set the Calculator project as your startup project and then change the parameter you pass to the run to be this:&lt;br&gt;

&lt;br&gt;
&lt;p&gt;&lt;span style="color:#2b91af"&gt;OMetaConsoleProgram&lt;/span&gt;.Run&amp;lt;&lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&amp;gt;(&lt;span style="color:#2b91af"&gt;OMetaConsoleOptions&lt;/span&gt;.CompileGrammars);&lt;br&gt;
&lt;br&gt;
This tells the code that Program inherits from that you want to compile the Calculator.ometacs fine to Calculator.cs.&lt;/p&gt;
&lt;/div&gt;&lt;div&gt; &lt;div&gt; &lt;p&gt;Read the &lt;a href="http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36138&amp;ANCHOR#Post119909"&gt;full discussion online&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;To add a post to this discussion, reply to this email (&lt;a href="mailto:ometasharp@discussions.codeplex.com?subject=[ometasharp:36138]"&gt;ometasharp@discussions.codeplex.com&lt;/a&gt;)&lt;/p&gt;
 &lt;p&gt;To start a new discussion for this project, email &lt;a href="mailto:ometasharp@discussions.codeplex.com"&gt;ometasharp@discussions.codeplex.com&lt;/a&gt;&lt;/p&gt; &lt;p&gt;You are receiving this email because you subscribed to this discussion on CodePlex. You can &lt;a href="http://www.codeplex.com/site/discussions/project/unsubscribe/ometasharp"&gt;unsubscribe or change your settings&lt;/a&gt; on codePlex.com.&lt;/p&gt;
 &lt;p&gt;Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at &lt;a href="http://codeplex.com"&gt;codeplex.com&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;/blockquote&gt;
&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Sun, 21 Sep 2008 22:00:42 GMT</pubDate><guid isPermaLink="false">New Post: Regenerating parsers 20080921100042P</guid></item><item><title>New Post: Regenerating parsers</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36138</link><description>&lt;div style="line-height: normal;"&gt;You should be able to set the Calculator project as your startup project and then change the parameter you pass to the run to be this:&lt;br&gt;
&lt;br&gt;
&lt;p&gt;&lt;span style="color:#2b91af"&gt;OMetaConsoleProgram&lt;/span&gt;.Run&amp;lt;&lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&amp;gt;(&lt;span style="color:#2b91af"&gt;OMetaConsoleOptions&lt;/span&gt;.CompileGrammars);&lt;br&gt;
&lt;br&gt;
This tells the code that Program inherits from that you want to compile the Calculator.ometacs fine to Calculator.cs.&lt;/p&gt;
&lt;/div&gt;</description><author>jeffmoser</author><pubDate>Sun, 21 Sep 2008 21:53:23 GMT</pubDate><guid isPermaLink="false">New Post: Regenerating parsers 20080921095323P</guid></item><item><title>New Post: Regenerating parsers</title><link>http://www.codeplex.com/ometasharp/Thread/View.aspx?ThreadId=36138</link><description>&lt;div style="line-height: normal;"&gt;Hi Jeff!$0$0$0$0New solution organisation looks great.$0$0$0$0$0I've deleted the generated 'Calculator.cs' file and can't seem to get it back, either by running the bootstrapper or README - any suggestions?$0$0$0$0$0Cheers,$0$0Nick$0&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Sun, 21 Sep 2008 20:23:12 GMT</pubDate><guid isPermaLink="false">New Post: Regenerating parsers 20080921082312P</guid></item></channel></rss>