Jump to content

Designing to keep EBNF data


keenlearner

Recommended Posts

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.

Link to comment
Share on other sites

Well, it's just basically a hierarchy... so you need a list of all of the possible pieces, then a parent_child relationship for each possible child (number and const for ae, for example), and then you'd need to "lookup" each child to see if it matches another item, and then lookup it's relationships, etc.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.