Exchange parameter, How?

qiwen@hamilton.mechanik.th-darmstadt.de (Alexander Dong)
Sat, 24 Jun 1995 04:29:10 GMT

          From comp.compilers

Related articles
Exchange parameter, How? qiwen@hamilton.mechanik.th-darmstadt.de (1995-06-24)
Re: Exchange parameter, How? boggs@osage.csc.ti.com (1995-06-26)
| List of all articles for this month |

Newsgroups: comp.compilers
From: qiwen@hamilton.mechanik.th-darmstadt.de (Alexander Dong)
Keywords: lex, yacc, question, comment
Organization: Technische Hochschule Darmstadt
Date: Sat, 24 Jun 1995 04:29:10 GMT
Status: RO

Hi!


We have a special language.
This is the function declaration:


function_declaration: function_name
                                              '('
                                     parameters
')'


parameters:
| parameters ',' one_parameter
| one_parameter
;


...


So this language is simular to C. A function is like:
function(a,b,c,d);


We want to write a program, which can exchange the parameters for us.
that is: function(b,a,d,c);


We are going to use LEX and YACC to do this. But we don't have the complete
grammar from this language. Is there a simple way to do this using lex & yacc
without to write the whole grammar?


Thanks very much!
Alexander Dong
qiwen@rbg.informatik.th-darmstadt.de
[You can probably do well enough by just fiddling things that look like
function calls, looking lexically for a name followed by an open paren.
-John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.