Ask a questionAsk a question
 

AnswerHow to Implement Syntax Lists?

  • Wednesday, September 30, 2009 7:23 AMGary Ranson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I am, so far, very impressed with the toolset provided by the OSLO project. I had been working with ANTLR to date, and found that OSLO is far simpler to implement - and do hope that this will go to a production release.

    Firstly I would like to say that I'm not an expert in language design, so please forgive me if this is a little fundamental. Here goes ...

    When implementing lists (such as argument lists), this is the common template which appears to be used ...

    syntax  ArgList
            =   a:Argument=> [a]
            |   list:ArgList "," a:Argument => {valuesof(list), a }    
            ;

    However, I have started to use this template ...

    syntax  ArgList
           = a:Argument b:("," b:Argument=> b)* => {a,valuesof(b)}
           ;

    They both return the same AST, but I was wondering if there is any difference "under-the-covers" ?

    Your comments are welcome.


Answers

All Replies