Re: [Gems-users] Using Ruby parameters on SLICC code?


Date: Tue, 6 Mar 2007 19:37:28 +0100
From: Enrique Vallejo Gutierrez <enrique@xxxxxxxxxxxxx>
Subject: Re: [Gems-users] Using Ruby parameters on SLICC code?
Liqun,

 

            Thank you for your reply. I hadn't notided that you had asked
exactly the same thing two days ago (as I said on the second message sent,
the google search didn't show up your message - it was too new). The
solution is similar to what I was considering about the TransactionManager,
but much smarter, with the specific class RubySlicc_Util: Using an external
class whose methods are declared in Ruby, to pass the global parameters to
the Slicc controller. 

 

As Mike said, it would be possible to extend the SLICC parser to understand
this... Maybe, parsing the config.include file before any other slicc file,
generating globals in the generated structure with the defined names, so
that it recognizes the variables that are used in SLICC. However, I have no
Jacc/bison knowledge at all, so the first "uglier" solution will become much
better and faster for me. ;)

 

Enrique Vallejo <http://www.atc.unican.es/~enrique/> 

University of Cantabria

 

  _____  

De: gems-users-bounces@xxxxxxxxxxx [mailto:gems-users-bounces@xxxxxxxxxxx]
En nombre de Liqun Cheng
Enviado el: martes, 06 de marzo de 2007 19:21
Para: Gems Users
Asunto: Re: [Gems-users] Using Ruby parameters on SLICC code?

 

Enrique,

I believe your problem is in slicc parser. I had the same problem before,
and here is Mike's reply.

Liqun

/************************************************** 
I always make an accessor function and define this in RubySlicc_Util.sm 
and RubySlicc_Util.h

Its probably possible to extend SLICC to do this automagically if you 
wanted.

--Mike
*****************************************************/




On 3/6/07, Enrique Vallejo Gutierrez <enrique@xxxxxxxxxxxxx> wrote:

Dear list,

        I was wondering if it is possible to customize the protocol
behaviour depending on the values of Ruby parameters. This is, for example,
to define an action that would be different depending on the parameter that 
was specified at execution time:

If (RubyParameter1){
        Do action a
}else{
        Take a different action
}

Obviously, this is simple to implement with two different SLICC protocols,
but I would like to know if it can be implemented in a single one, to
simplify and use parameters at execution time, and to avoid defining and
modifying the same file multiple times with minor changes.

I have tried, with no success, to use the Protocol options (like 
TwoLevelCache or XactMemory) or RubyConfig options, but they are not
recognized when the slicc code is parsed. I have seen that parameters can be
used, quoted, to determine queues latencies, but this is a special case 
which is considered in slicc\ast\EnqueueStatementAST.C. The only solution
that comes to my mind is to use methods in a given class defined outside
SLICC (such as TransactionManager) that directly return the value of the 
given parameter (xact_mgr.getRubyParameter1(), etc), but that looks very
ugly.

Has somebody some experience on this? I haven't found any information on
previous messages on the list.

Thank you in advance, 

Enrique Vallejo <http://www.atc.unican.es/~enrique/>
University of Cantabria, Spain

_______________________________________________
Gems-users mailing list 
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:
https://lists.cs.wisc.edu/archive/gems-users/"; to your search.




 

<<attachment: winmail.dat>>

[← Prev in Thread] Current Thread [Next in Thread→]