You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Nero Couvalli <an...@gmail.com> on 2011/03/20 17:15:28 UTC

Regarding antlr in Pig.

Hello to everyone,

I have been experimenting with Pig 0.7 source code some time and have two
questions regarding command parsing in Pig.
I located two files in org.apache.pig.parser package named queryLexer.g and
queryParser.g, which, if I understood rightly, have the required antlr code
in order to parse commands in Pig.
The first question is if these two files are the only files that i must make
changes in order for pig to recognize (lexically and syntactically) a new
command.
The second question is whether these files, if altered, need to be
recompiled with antl in order to work (and what command is needed, if that
is the case).

Thank you in advance,

Nero.

Re: Regarding antlr in Pig.

Posted by Alan Gates <ga...@yahoo-inc.com>.
Are you working with 0.7 source or off of trunk?  In 0.7 Pig used  
javacc to generate its parser.  In trunk, only in the last few weeks,  
we have switched to antlr.

Other comments inline.

On Mar 20, 2011, at 9:15 AM, Nero Couvalli wrote:

> Hello to everyone,
>
> I have been experimenting with Pig 0.7 source code some time and  
> have two
> questions regarding command parsing in Pig.
> I located two files in org.apache.pig.parser package named  
> queryLexer.g and
> queryParser.g, which, if I understood rightly, have the required  
> antlr code
> in order to parse commands in Pig.
> The first question is if these two files are the only files that i  
> must make
> changes in order for pig to recognize (lexically and syntactically)  
> a new
> command.
It depends on what you want to change.  For core Pig Latin changes,  
yes, this is all you need.  If you want to make changes to the shell  
commands (cd, mkdir, etc.) that is handled by grunt and has a  
different parser.  If you want to make changes to how pre-processing  
works, that also is a separate parser.

> The second question is whether these files, if altered, need to be
> recompiled with antl in order to work (and what command is needed,  
> if that
> is the case).
The build system handles regenerating the files when you change them.   
Just type 'ant' (or click the appropriate button in your IDE) and all  
will be done.

Alan.

>
> Thank you in advance,
>
> Nero.