[erlang-questions] Problems with the Erlang grammar and yecc

Vlad Dumitrescu vladdu55@REDACTED
Wed May 7 12:08:29 CEST 2014


Hi!

The erl_parse.yrl grammar handles only one form at a time (the root symbol
is 'form'). You have to split the input at 'dot' tokens and parse each of
the resulting lists of tokens. I would recommend to use the erl_parse
functions, they do some "massaging" of the tokens.

regards,
Vlad



On Wed, May 7, 2014 at 11:58 AM, Alessandro Sivieri <
alessandro.sivieri@REDACTED> wrote:

> Hi,
>
> I was experimenting with yecc and the Erlang grammar (taken from stdlib
> sources), but I got immediately stuck.
>
> I wrote a very simple module (e.g., a module defining one single
> function), then I executed the following sequence of actions:
>
> * put the content of the module in a single string
> * tokenize it using erl_scan
> * parse it using the module generated by yecc
>
> If I follow this sequence of actions, I get the following error:
>
> {error,{2,erl_grammar,["syntax error before: ","'-'"]}}
>
> I think it gets stuck in the "export" definition, because if my module
> contains only the "module" definition, I get no errors.
>
> Any idea?
>
> --
> Sivieri Alessandro
> alessandro.sivieri@REDACTED
> http://sivieri.wordpress.com/
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140507/df2ea26a/attachment.htm>


More information about the erlang-questions mailing list