Page 1 of 1

Designing to keep EBNF data

Posted: Fri Aug 31, 2007 7:20 pm
by keenlearner
Hello, I want to make a documentation for my application. There will be many functions, if user want to know how to use a certain function, he has to refer to EBNF grammar. E.g one of EBNF grammar for evaluating arithmetic expression.
(* ae short for arithmetic expressions
if you are not sure the EBNF you might one to take a quick view from http://en.wikipedia.org/wiki/Ebnf
*)

ae = ae, (binary operator, ae)*
ae = prefix function, ae
ae = ae, postfix function
ae = "(" ae ")"
ae = NUMBER | CONSTANT
binary operator = "+" | "-" | "*" | "/" | "%" | "^"
prefix function = "sin" | "cos" | "tan"
NUMBER = INTEGER | FLOAT
CONSTANT = "pi" | "e"
INTEGER = ["+" | "-"] DIGIT
(* and so on *)

so as I said there are many functions, the above one is one of them, when I want to write the EBNF of other function, I might be using some of the expression above all over again, especially the NUMBER, INTEGER. You can also see that there is a parent and child relation of NUMBER with FLOAT, INTEGER. So I want anyone's advices on how should I design the table structure or fields, to keep all the repetitive EBNF expression ? Thank you.