Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Question of yecc
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Álvaro  
View profile  
 More options Nov 15 2012, 11:35 am
From: Álvaro <avalormaqued...@gmail.com>
Date: Thu, 15 Nov 2012 17:35:27 +0100
Local: Thurs, Nov 15 2012 11:35 am
Subject: Re: [erlang-questions] Question of yecc

Hi,

I think the problem is that yecc does not recognize the terminal 'num'.
The default scanner recognizes 'integer' and 'float'.
Change your 'num' for 'integer' and try again.

Best,
Álvaro

2012/11/15 Solomon <solomon....@gmail.com>

> I want to write a parser to parse the string like this:
>   a.id = b.id
>   a.id = 10

> My yrl file like this:
> *Nonterminals
>     val expr alias field.

> Terminals
>     '=' '>' '>=' '<=' '<' '!=' '.' 'atom'
>     'num'.

> Rootsymbol
>     expr.

> expr->val '=' val:['$1', '$3', {'opt', '='}].
> expr->val '>' val:['$1', '$3', {'opt', '>'}].
> expr->val '>=' val:['$1', '$3', {'opt', '>='}].
> expr->val '<' val:['$1', '$3', {'opt', '<'}].
> expr->val '<=' val:['$1', '$3', {'opt', '<='}].
> expr->val '!=' val:['$1', '$3', {'opt', '!='}].

> val->alias '.' field:{'$1', '$3'}.
> val->num:{'num', '$1'}.

> alias->atom:{'alias', '$1'}.
> field->atom:{'field', '$1'}.*

> it is ok for "a.id=b.id":
> *{ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}},
>      {{alias,{atom,1,b}},{field,{atom,1,id}}},
>      {opt,'='}]}*

> and it is ok for "a.id=b":*
> {ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}},
>      {num,{atom,1,a}},
>      {opt,'='}]}*

> but it error for "a.id=12":
> *{error,{1,my_parser,["syntax error before: ","12"]}}*

> what is wrong with my yrl file?

> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.