Skip Navigation
 
 
/* ------------------------------------------------------------------------ */
/*                                                                          */
/* [lua.abs]                   Abstract Grammar                             */
/*                                                                          */
/* ------------------------------------------------------------------------ */

LANGUAGE lua

TOKENS

  PI, name, string, LongStringBlk, LongStringPat, LongStringEnd, LongStringAny, number

TYPES

  lua               = Start_Chunk(Chunk);
                      Start_Block(Stat*)

  Chunk             = blk(Stat*);
                      pi(PI, Stat*)

  Stat              = fornum(name, Exp, Exp, Exp, Stat*);
                      funrec(name, FunBody);
                      local(name*, Exp*);
                      break;
                      noop;
                      return(Exp*);
                      else(Stat*);
                      scope(Stat*);
                      fundcl(FunName, FunBody);
                      forin(name*, Exp*, Stat*);
                      goto(name);
                      repeat(Stat*, Exp);
                      call(Exp);
                      branch(Exp, Stat*, Stat);
                      label(name);
                      assign(Var*, Exp*);
                      while(Exp, Stat*)

  FunBody           = funlit(Par*, Stat*)

  FunName           = meth(name*, name);
                      path(name*)

  Par               = var;
                      nam(name)

  LongStringBody    = end(LongStringEnd, LongStringBody);
                      nul;
                      any(LongStringAny, LongStringBody)

  LongString        = blk(LongStringBlk);
                      pat(LongStringPat, LongStringBody, LongStringPat)

  Lit               = llstr(LongString);
                      ltrue;
                      lfalse;
                      lnum(number);
                      lstr(string);
                      lone;
                      lnil

  Exp               = ge(Exp, Exp);
                      cat(Exp, Exp);
                      gt(Exp, Exp);
                      add(Exp, Exp);
                      call(Exp, Exp*);
                      and(Exp, Exp);
                      rem(Exp, Exp);
                      exp(Exp, Exp);
                      siz(Exp);
                      div(Exp, Exp);
                      not(Exp);
                      dots;
                      neg(Exp);
                      le(Exp, Exp);
                      ne(Exp, Exp);
                      mul(Exp, Exp);
                      or(Exp, Exp);
                      sub(Exp, Exp);
                      lfun(FunBody);
                      var(Var);
                      lit(Lit);
                      lt(Exp, Exp);
                      par(Exp);
                      table(Field*);
                      mcal(Exp, name, Exp*);
                      eq(Exp, Exp)

  Var               = ide(name);
                      idx2(Exp, name);
                      idx1(Exp, Exp)

  Field             = idx1(Exp, Exp);
                      idx2(name, Exp);
                      exp(Exp)