合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

        COMP4233代做、代寫Python/Java程序
        COMP4233代做、代寫Python/Java程序

        時間:2025-06-04  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



        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].

        請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

        掃一掃在手機打開當前頁
      1. 上一篇:代做159.342 、代寫Operating Systems 編程設計
      2. 下一篇:代寫MIT203、代做SQL編程設計
      3. 無相關信息
        合肥生活資訊

        合肥圖文信息
        急尋熱仿真分析?代做熱仿真服務+熱設計優化
        急尋熱仿真分析?代做熱仿真服務+熱設計優化
        出評 開團工具
        出評 開團工具
        挖掘機濾芯提升發動機性能
        挖掘機濾芯提升發動機性能
        海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
        海信羅馬假日洗衣機亮相AWE 復古美學與現代
        合肥機場巴士4號線
        合肥機場巴士4號線
        合肥機場巴士3號線
        合肥機場巴士3號線
        合肥機場巴士2號線
        合肥機場巴士2號線
        合肥機場巴士1號線
        合肥機場巴士1號線
      4. 短信驗證碼 酒店vi設計 deepseek 幣安下載 AI生圖 AI寫作 AI生成PPT

        關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

        Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
        ICP備06013414號-3 公安備 42010502001045

        主站蜘蛛池模板: 亚洲色精品aⅴ一区区三区| 国产自产在线视频一区| 国产精品日韩一区二区三区| 久久国产精品一区| 国产精品一区二区无线| 日韩一区二区三区无码影院| 一区二区三区四区在线观看视频 | 成人精品一区二区三区校园激情| 少妇特黄A一区二区三区| 久久国产一区二区三区| 中文字幕一区日韩在线视频 | 中文字幕一区二区精品区| 无码精品人妻一区二区三区中| 人妻天天爽夜夜爽一区二区| 久久精品一区二区三区AV| 国产精品一区二区不卡| 中文乱码人妻系列一区二区| 一区二区国产精品| 亚洲一区二区三区乱码A| 中文字幕视频一区| 无码人妻一区二区三区在线视频 | 久久99国产精一区二区三区| 国产日韩精品一区二区在线观看播放 | 日韩亚洲AV无码一区二区不卡| 国产伦精品一区二区三区四区 | 91精品国产一区二区三区左线| 日韩精品人妻av一区二区三区| 成人h动漫精品一区二区无码| 国产精品亚洲一区二区麻豆 | 色老头在线一区二区三区| 国产一区二区三区精品视频| 一区二区三区91| 女女同性一区二区三区四区| 亚洲AV美女一区二区三区| 亚洲AV成人一区二区三区AV| 国模无码人体一区二区| 久久精品视频一区| 蜜桃视频一区二区三区在线观看| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 日本一区二区不卡视频| 好吊视频一区二区三区|