随笔-91  评论-137  文章-0  trackbacks-0

sym->[a-z|A-Z|_][a-z|A-Z|0-9|_]*

int->[0-9]+

real->[0-9]+.[0-9]+

string->

datatype->”int” | “real” | “bool” | “string”

 

prgama->function | functionheader “;”

functionheader->”function” sym ”(“ parameters ”)”  [“as” datatype]

parameters->[[sym as datatype],parameters]

function->functionheader “{“ block “}”

block->statementlist

statement->local-stmt | if-stmt | while-stmt | do-stmt | for-stmt | switch-stmt | assign-stmt | call-stmt | return-stmt

local-stmt->”local” varlist

varlist->symlist “as” datatype [“,” varlist]

if-stmt->”if” exp statementlist [“else” statementlist]

while-stmt->”while” exp statementlist

do-stmt->”do” statementlist “while” exp “;”

for-stmt->”for” “(“ exp “;” exp “;” exp “)” statementlist

switch-stmt->”switch” exp “{“ case-stmt “}”

case-stmt->(”case” sym | “default”) “:” statementlist case-stmt

assign-stmt->exp “=” exp

call-stmt->sym “(“ parameters “)” “;”

return-stmt->”return” exp

 

symlist->sym [“,” symlist]

statement->“{“ statementlist “}”

statement->”;”

statementlist->statement [statementlist]

 

exp->exp1

exp1->exp2

exp1->exp1 (“<” | “<=” | “=” | “>=” | “>” | “!=”) exp2

exp2->exp3

exp2->exp2 (“+” | “-“) exp3

exp3->exp4

exp3->exp3(“*” | “/”) exp4

exp4->”(“ exp “)”

 

posted on 2010-06-26 10:37 lwch 阅读(404) 评论(0)  编辑 收藏 引用 所属分类: NScript

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理