[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is possible to generate Lua Grammar in LL(1)?
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Fri, 14 Oct 2011 08:05:32 -0300
Rafael,
This Lua grammar for ANTLR looks like it is most of the way there:
http://antlr.org/grammar/1178608849736/Lua.g, but it ignores operator
precedence. The parser in the Lua implementation
(http://www.lua.org/source/5.1/lparser.c.html) is mostly a
straightforward recursive descent parser, with expressions being the
tricky part (it uses precedence climbing, see
http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm and
http://compilers.iecc.com/comparch/article/92-05-140, or just read the
code :-) ).
--
Fabio Mascarenhas
On Fri, Oct 14, 2011 at 6:26 AM, Rafael Bittencourt
<rafaelobitten@gmail.com> wrote:
> Hi,
> I am developing compiler for Lua Language and I implemented the algorithm of
> Non recursive syntax analysis. But it need the language is in LL(1) form.
> So, i have tried reduce the Lua
> grammar(http://www.lua.org/manual/5.1/manual.html) for this form. But i
> didnt have sucess. I wanna know if is possible convert this grammar to
> LL(1), i saw the code of compiler in c and i read in any comment that use
> the LL(1) form.
> Greetings
> --
> Rafael de Oliveira Bittencourt
> ---------------------------------------------------------------------
> Bacharelando em Ciência da Computação -UFBA
> Estagiário Suporte-CPD/UFBa (71) - 3283-6119
> GNU/Linux Registered User #499863
>