使用Coco/R帮助修复.atg文件中的错误! [英] Help to fix error in .atg file using Coco/R!

查看:142
本文介绍了使用Coco/R帮助修复.atg文件中的错误!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

COMPILER  Expr
CHARACTERS
 letter    = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
 digit     = "0123456789".
  cr        = '\r'.
  lf        = '\n'.
  tab       = '\t'.
  stringCh  = ANY - '"' - '\\' - cr - lf.
  charCh    = ANY - '\'' - '\\' - cr - lf.
  printable = '\u0020' .. '\u007e'.
  hex       = "0123456789abcdef".

////////////////////////////////////////////////
TOKENS
    Type = "number"|"float"|"string"|"bool".

    ident   ="letter" {"letter" | "digit" | '_'}.
    number  =digit {digit}.
    float   ="digit" {"digit"} '.' "digit" {"digit"} ['E' ['+' | '-'] "digit" {"digit"}].
        string  = '"' {"stringCh" | '\\' "printable"} '"' | "'" { charCh | '\\' printable} "'"  .
        bool    ="true"|"false".
    COMMENTS FROM "/*" TO "*/" NESTED
    COMMENTS FROM "//" TO "\r\n"

    //print="print".
    //read="read".
    //assign="assign".
    //IGNORE ='\r' + '\n'.

    /*----- ----------------keyword names needed  ---------------------------*/

//  line 46 error here 
            char       ="char".
            bool       ="bool".
            continue   ="continue".
            do         ="do".
            double     ="double".
            else       ="else".
            false      ="false".
            float      ="float".
            for        ="for".
            foreach    ="foreach".
            if         ="if".
            in         ="in".
            int        ="int".
            return     ="return".
            string     ="string".
            switch     ="switch".
            while      ="while".
            break      ="break".

PRODUCTIONS

    Expr    =   SimExpr [RelOp SimExpr].
    SimExpr =   Term {AddOp Term}.

    Term    =   Factor {mull Factor}.
    mull    =   "*" | "/".
    Factor  =   ident | number | "-" Factor | bool.
    RelOp   =   "==" | "<" | ">".
    AddOp   =   "+" | "-".
     digit     = "0123456789".
    WhileStat =     "while""(" Expr ")" Stat.
    IfStat =    "if""(" Expr ")" Stat ["else" Stat ].
    SwitchStat=   "switch" "(" Expr ")" "{" {SwitchSection} "}".
    SwitchSection= SwitchLabel { SwitchLabel } Stat { Stat }.
    SwitchLabel= "case" Expr ":" | "default" ":".

    ForStat=    "for""(" [ForInit] ";" [Expr] ";" [ForInc] ")".
    ForInit=    "int" ident"="digit.
        ForInc=     ident"++".
    ForeachStat=    "foreach" "(" Type ident "in" Expr ")"

        Stat.
    PrintStat=  "print""("ident |string")".
    ReadStat=   "read""("ident |string")".
    AssignStat=     ident"==" Expr.
     Stat = ident"=" Expr.
    breakStat= "break" ";".
        continueStat= "continue" ";".
    returnStat ="return" Expr ";".
END Expr.




请帮助我修复此文件中的错误,以获取.cs文件(解析器,词法分析)




Please help me to fix the errors in this file to get .cs files (parser,lexical)

-- line 46 col 4: undefined name
1 errors detected

推荐答案

您怎么不联系那些此项目: http://ssw.jku.at/coco/ [ http://www.ssw.uni-linz.ac.at/General/Staff/HM / [ ^ ]

http://www.ssw.uni-linz.ac.at/General/Staff/ML / [ ^ ]
不要忘记
http://www.ssw.uni-linz.ac.at/General/Staff/AW / [ ^ ]

问候,
-MRB
How come you''re not contacting the guys who did this project: http://ssw.jku.at/coco/[^]. Why do you think you''d get more help here than where the stuff was actually coded.
There are links on the homepage of that project you know:

http://www.ssw.uni-linz.ac.at/General/Staff/HM/[^]
and
http://www.ssw.uni-linz.ac.at/General/Staff/ML/[^]
not to forget
http://www.ssw.uni-linz.ac.at/General/Staff/AW/[^]

Regards,
-MRB


这篇关于使用Coco/R帮助修复.atg文件中的错误!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆