help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bison: Grammar for function definitions...


From: Geten
Subject: Bison: Grammar for function definitions...
Date: Sat, 17 May 2008 08:08:13 -0700 (PDT)

Hi

I am little more than a beginner in writing bison specifications and now I
have stumbled on some problems. What I want to do is to write grammar to
recognize a function definition that looks like this more or less:


function functionName (parameters) : returnType

localDeclarations

localFunctionDefinitions // functions in function

FunctionBlockStart

FunctionMainBody

FunctionBlockEnd;



A code example:

function helloWorld(int p1, int p2) : bool

int a = p1;
int b = p2;

// Another function declaration here...

start

// blablablablabla do something

end;


What would a grammar that handled that look like? No need to supply a
complete grammar. I have already produced grammars for declarations of
variables, parameters and so on. For example how do I handle optional in
function declarations and optional in function function declarations?

-- 
View this message in context: 
http://www.nabble.com/Bison%3A-Grammar-for-function-definitions...-tp17292769p17292769.html
Sent from the Gnu - Bison - Help mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]