Scala代写:CSE262 Table Driven Scanner代写R编程、R语言程序帮写

代写Scala作业,练习Scala的编程设计。IntroductionThis project is to implement the table driven scanner given in Figure 2.11 (pg. 66) in the text, which will use the table in Figure 2.12 (pg. 67) to scan the tokens for the same “calculator” language as my ad hoc scanner. You will need to implement the algorithm in Fig. 2.11 in Scala using the starting program provided on Coursesite. The table in Fig, 2.12 is included in the file table.txt on Coursesite.ProcedureCreate a folder to hold the project, including the Scala source code file (TableDrivenScanner.scala), the table file (table.txt) and the test file (testexpr.txt).Fill in the comment at the top of the TableDrivenScanner.scala file with your name and email.Fill in the provided starter version of TableDrivenScanner.scala with code to implement the table driven scanner.Your program must be able to be run by typing “sbt run” from the project folder.When your program is working, zip up the folder and upload it to CourseSite.Notes on writing the code (you might want to read this with the book open to page 66):a. state and token at the top of Fig 2.11 are types, not variables. In particular, they are Ints that have a given range of values. The range of values can be ignored in your code.b. The arrays scan_tab and token_tab need to be read in from the file table.txt. Study Fig 2.12 to understand the contents of this file. token_tab is filled in from the last column of the table; scan_tab from the rest of the table. I have already provided keyword_tab already fillScala代写:CSE262 Table Driven Scanner代写R编程、R语言程序帮写ed as a Scala Map.c. remembered_chars is defined as a “list of char”. You can define this in whatever is most convenient, perhaps a List[Char] or just a String or StringBuffer.d. There are no “repeat” or “loop” structures in Scala (although, as we’ll see later, we could add them to the language!). These are probably best implemented as while loops.e. In addition to a method for reading a char from the input file you need an “unread” method that puts a character back. This could just be a matter of subtracting 1 from the current character index. (see nextchar from the ad hoc scanner)f. What you use for e will depend on what type you use for remembered_chars. Perhaps just an empty string if remembered_chars is a string.g. The columns in the table represent characters, actually character categories, so there needs to be some sort of conversion. For instance, if you read the character ‘5’, this needs to be treated as a digit.h. Rather than the tuple

indicated in Fig 2.11, the return value (from nexttoken) should be the same as the ad hoc parser - one if the case object tokens and in the case of Number and Id it should include the image string. E.g. .234 is returned as Number(.234).Your program will be graded based on correctness, style, and efficiency. There is a 10% penalty off the top for each day that the program is late. On the third day after the due date the submission has no point value. There will be no extensions.转自:http://ass.3daixie.com/2019012924650139.html

你可能感兴趣的:(Scala代写:CSE262 Table Driven Scanner代写R编程、R语言程序帮写)