# Parse.y (was Ripper and 1.8)

**URL:** <https://www.ruby-forum.com/t/parse-y-was-ripper-and-1-8/65930>\
**Category:** Ruby\
**Created:** [August 22, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/parse-y-was-ripper-and-1-8/65930 "2006-08-22T14:11:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 22, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/parse-y-was-ripper-and-1-8/65930/1 "2006-08-22T14:11:55Z")

</div>

Hi all,

I’ve been poking around Ripper for the last couple a days and during  
that process I started to look at parse.y as it’s currently in CVS (Ruby  
1.9 that is).  
I’m not very knowledgeable about yacc and parsers in general but I just  
wanted to ask a quick question.

## In parse.y I see alot of /_%%%_/ and /_% --code-- %_/“constructs” for example:

## primary : literal | strings | xstring | regexp | words | qwords | var\_ref | backref | tFID { /_%%%_/ $$ = NEW\_FCALL($1, 0); /_% $$ = method\_arg(dispatch1(fcall, $1), arg\_new()); %_/ }

I’ve started reading the bison manual but I can’t find any reference to  
this construct.  
My question: Are these lines just comments or are they instructing  
bison?

Again, any help is greatly appreciated.

With kind regards,  
Jonathan

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 22, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/parse-y-was-ripper-and-1-8/65930/2 "2006-08-22T14:19:55Z")

</div>

> > > > > “J” == Jonathan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

J\> In parse.y I see alot of /_%%%_/ and /_% --code-- %_/“constructs” for

Look at the file

ruby/ext/ripper/tools/preproc.rb

Guy Decoux

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [August 22, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/parse-y-was-ripper-and-1-8/65930/3 "2006-08-22T14:21:55Z")

</div>

Jonathan M. wrote:

> ```
> /*%%%*/
> $$ = NEW_FCALL($1, 0);
> /*%
> $$ = method_arg(dispatch1(fcall, $1), arg_new());
> %*/
> 
> ```

It’s a construct needed for Ripper.

For Bison, the code of the first line is normal code, the second is  
comment. So the relevant part for Bison is:

$$ = NEW\_FCALL($1, 0);

In Ripper, there needs to be different code, so a script preprocesses  
the whole parse.y, removes the text from /_%%% to /_% and removes the  
%\*/, so the second code line is relevant:

$$ = method\_arg(dispatch1(fcall, $1), arg\_new());

Have a look at ext/ripper/tools/preproc.rb to see how the preprocessing  
works in detail.

Robin S.
