lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I included the how the DD would look like


Basic DD capablities

#include "constant.hdd"

#define MY_DEF  1
#define WIDGET_TYPE 1
 
WIDGET mywidget
{
    TITLE "My widget";
    TYPE WIDGET_TYPE;
    ELEMENTS
    { 
        element1,
        element2,
        element3       
    }
}

IMPORT  WIDGET mywidget
{
    REFINE widget_name{
        REDEFINE TITLE "Your widget";
    }
}

#ifdef YOUR_WIDGET_ALLOWED
WIDGET yourwidget
{
    TITLE "Your widget";
    TYPE WIDGET_TYPE;
    ELEMENTS
    { 
        element1,
        element2,
        element3       
    }
}
#endif

For Loop but needs pre-declaration of loop variable

int x;

for ( x=0; x < 8; x++)
{
   if ( something_true )
       do_this(argument1, argument2);
}

supports

do
{
    statements;
}while(condition);

supports

while(condition)
{
    statements;
}

switch statement supported



The idea is to run everything on Lua with differnt platforms like iOS/Android/Windows application. We will write appropriate engines that power UI based on different platform but the actual controls used shall be wrapped.

--

Gopal



On Mon, Aug 22, 2011 at 7:28 AM, Should Pain <pengzhicheng1986@gmail.com> wrote:
于 2011-8-22 12:58, Gopalakrishnan Subramani 写道:

I want to learn the Language parsing in Lua. The idea is to parse a language called DDL (Device Description Language) and generate the Lua code out of it.

Where I can start with if I don't know how the languages and semantics works? Are any Lua library supports easy language parsing?

The .NET version (http://irony.codeplex.com/) is huge and it is difficult to understand. I believe, Lua could support simple parsing and AST building and code generation easily.

--

Gopal
see the `meta-lua' project, which includes some useful utilities, and which is itself a good example of AST parsing and manipulating and things like such.

I have learned a lot from meta-lua, both the code and the manual.

You may see to it.

Goodlucky.