You can do function calls in a form of BNF.

by RpgFan (Login rpgfan3233)
R

declare_stmt    ::= "DECLARE" ("SUB" alnum+ | "FUNCTION" alnum+ suffix)

"(" func_arg ("," func_arg)* ")"
func_arg ::= dim_expr | alpha alnum+ suffix
dim_expr ::= alpha alnum+ ("(" dimensions ")")? "AS" typename
alnum ::= alpha | [0-9]
alpha ::= [A-Za-z]
suffix ::= "%" | "!" | "&" | "#" | "$"
typename ::= "INTEGER" | "LONG" | "SINGLE" | "DOUBLE" | "STRING"


No, that's not complete, nor is it even halfway correct. I simply did it to show how amazingly annoying it would be to do it. With the way QB is structured, it is rather difficult to do. Oh, and did I mention that I didn't even think about spacing between tokens, never mind the whole bit where you can separate things onto multiple lines using the underscore at the end of a line (assuming you're not in the interpreter)?

QB's grammar is a mess, no matter how clean it appears to be. I'd recommend that you not waste your time unless you seriously have nothing better to do.



    
This message has been edited by rpgfan3233 on May 12, 2009 5:02 AM

Posted on May 12, 2009, 5:00 AM

Respond to this message   

Return to Index