合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        COMP4233代做、代寫(xiě)Python/Java程序
        COMP4233代做、代寫(xiě)Python/Java程序

        時(shí)間:2025-06-04  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



        COMP4233 25S
        Programming Assignment
        Introduction
        In Lecture 11, we implement an integer calculator, which consists of 
        - int : the only data type for integers
        - + : binary operator for integer addition
        - * : binary operator for integer multiplication
        - ( ) : parentheses for force parsing
        - parser and evaluator of the expressions in this language.
        In Lab 11, we extend the language by let expression, identifiers and its evaluator in the 
        substitution model. This upgrade implements a naming system for the language.
        Syntax
        In this programming assignment, you need to further extend the language with following 
        features.
        1. if … then … else … : the “if” expression, which can branch computations under 
        some conditions.
        2. fun … -> … : function definitions, which can also be with let to name them.
        To make if statement work properly, we also need 
        3. a new data type bool, the guard in if;
        4. constants in bool are either true or false;
        5. Boolean binary operator ^, boolean conjunction;
        6. bool can be constructed from the relational operator <=, integer “less or equal to”.
        We want to add a little bit more complex structure into our language, which are
        7. a new data type list with only one constant list [] – the empty list; and
        8. lists can be constructed by binary operator ::, which is right associative.
        Combining everything above, the entire grammar is
        <prog> -> <expr> EOF
        <expr> -> int
         | <expr> + <expr>
         | <expr> * <expr>
         | ( <expr> )
         | id
         | let id = <expr> in <expr>
         | fun id -> <expr>
         | <expr> <expr>
         | if <expr> then <expr> else <expr>
         | bool
         | <expr> <= <expr>
         | <expr> ^ <expr>
         | []
         | <expr> :: <expr>
        Note that <expr> -> <expr> <expr> is the syntax for function application.
        For the precedence of operators, we only specify + is lower than *. Others will be guaranteed 
        by parentheses. For example, ambiguous expressions like fun a -> a 1 will be excluded 
        from testcases. This expression has to be either fun a -> (a 1) or (fun a -> a) 1.
        Typing
        To make your life easy, type system is excluded from this project. Thus, expressions with 
        type errors, like 1 + true are excluded from testcases.
        Evaluation
        The evaluation for operators simply follows their behaviors in mathematics. Students should 
        understand them easily. But if a student insists true ^ true --> false, marks will be 
        remove. Goliath does not want to argue.
        The evaluation for let expression is implemented by substitution model and already given in 
        Lab 11.
        let <x> = v in <expr> --> <e>{v / <x>}
        (let <x> = v in <expr>){v / <y>} -->
        if <x> = <y> then (let <x> = <expr>)
        else (let <x> = <expr>{v / <y>}
        Students should figure out the substitutions for functions, function applications, and lists by 
        themselves, which is interesting and not difficult. Furthermore, we also guarantee that 
        function arguments are of distinct names. Expressions like let x = z in (fun z -> x)
        are excluded from testcases. The following substitution is naïve and not correct.
        let x = z in (fun z -> x)
         --> (fun z -> x) {z / x}
         --> fun z -> x {z / x}
         --> fun z -> z
         -/->
        Output
        To printout an AST, two functions string_of_val and string_of_bop are defined in 
        main.ml. You can also apply these functions to see if your implementation works normally.
        Example
        Here is one example, 
        let x=(fun a -> (if (a <= 1) then true else false)) in ((x 1) :: [])
        is parsed into 
        and evaluated as
        let x=(fun a -> (if (a <= 1) then true else false)) in ((x 1) :: [])
        --> ((x 1) :: []){fun a -> .. /x}
        --> ((x 1){fun a -> .. /x} :: []{fun a -> .. /x}
        --> ((x{fun a -> .. /x} 1{fun a -> .. /x}) :: []{fun a -> .. /x})
        --> (((fun a -> ..) 1{fun a -> .. /x}) :: []{fun a -> .. /x})
        --> (((fun a -> ..) 1) :: []{fun a -> .. /x})
        --> (((fun a ->(if (a<=1) then true else false) 1) :: [])
        --> ((if (a <= 1) then true else false){1/a} :: [])
        --> ((if (a <= 1){1/a} then true{1/a} else false{1/a}) :: [])
        --> ((if (a{1/a} <= 1{1/a}) then true{1/a} else false{1/a}) :: [])
        --> ((if (1 <= 1{1/a}) then true{1/a} else false{1/a}) :: [])
        --> ((if (1 <= 1) then true{1/a} else false{1/a}) :: [])
        --> ((if true then true{1/a} else false{1/a}) :: [])
        --> (true{1/a} :: [])
        --> (true :: [])
        -/-> 
        Submission
        ast.ml and lexer.mll are given in the package. You only need to implement 
        parser.mly and main.ml. You don’t need to change anything else, including file names.
        Grade distribution
        - Submission 5%
        - Compilation 5%
        - parsing if statements 15%
        - evaluating if statements 10%
        - parsing functions and function applications 15%
        - evaluating functions and function applications 10%
        - parsing & evaluating relational operator <= 10%
        - parsing & evaluating Boolean conjunction ^ 10%
        - parsing lists 10%
        - evaluating lists 10%
        Select the features that you have implemented in check_list.md by [x].

        請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

        掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
      1. 上一篇:代做159.342 、代寫(xiě)Operating Systems 編程設(shè)計(jì)
      2. 下一篇:代寫(xiě)MIT203、代做SQL編程設(shè)計(jì)
      3. 無(wú)相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
        急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
        出評(píng) 開(kāi)團(tuán)工具
        出評(píng) 開(kāi)團(tuán)工具
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士4號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
        合肥機(jī)場(chǎng)巴士3號(hào)線
        合肥機(jī)場(chǎng)巴士2號(hào)線
        合肥機(jī)場(chǎng)巴士2號(hào)線
        合肥機(jī)場(chǎng)巴士1號(hào)線
        合肥機(jī)場(chǎng)巴士1號(hào)線
      4. 短信驗(yàn)證碼 酒店vi設(shè)計(jì) deepseek 幣安下載 AI生圖 AI寫(xiě)作 aippt AI生成PPT

        關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

        Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
        ICP備06013414號(hào)-3 公安備 42010502001045

        国产亚洲精品a在线无码| 国产精品一二三区| 国内精品久久久久久无码不卡| 国产精品成人观看视频网站| 亚洲精品国产摄像头| 久久精品国产99国产精品澳门| 国产精品午夜福利在线观看地址| 久久精品99久久香蕉国产| 无码欧精品亚洲日韩一区| 亚洲精品国产情侣av在线| 久久精品国产WWW456C0M| 精品久久久久久中文字幕女| 色欲国产麻豆一精品一AV一免费 | 日韩资源在线观看| 99久久国产亚洲综合精品| 精品亚洲永久免费精品| 日韩成全视频观看免费观看高清| 精品少妇人妻AV一区二区| 欧产日产国产精品精品| 久久99精品久久久久久9蜜桃| 国产伦子系列麻豆精品| 2021精品国产综合久久| 人妻少妇精品中文字幕av蜜桃| 久久精品国产清自在天天线| 日韩人妻无码精品一专区| 午夜精品在线免费观看| 999久久久免费精品国产| 久久亚洲日韩精品一区二区三区 | 久久精品国产一区二区三区肥胖| 精品久久久久久无码免费| 日韩精品无码一区二区中文字幕| 亚洲av无码成人精品国产| 亚洲国产成人久久99精品| 日韩精品区一区二区三VR| 亚洲中文久久精品无码ww16 | 精品国产福利久久久| 久久亚洲精品无码观看不卡| 亚洲精品无码激情AV| 日韩伦理片电影在线免费观看| 国产av一区二区精品久久凹凸| 国产精品久久久久久亚洲影视|