subject

Build a hash table using chaining as the collision resolution technique. insertions into the hash table will correspond to declarations of variables and values in a program, searches will be requests for the value of a variable. some variables will be local and have a narrow scope while some variables will be global. the program will take input from a file, another program written in the omnipotent programming language borg (bionicly omnipotent resistance grinders) and generate output from this program. the borg language has the following commands (keywords): start-finish blocks. indicating different scopes. com - single line comments: text should be ignored if on the same line var varname – variable declaration, adds β€œvarname” to the hash table. value = expression – assignment statements, ie george = 122. find george in the hash table and assign 122 to it. ++ - increment operator, syntax: variable ++ -- - decrement operator, syntax: variable -- expressions, expressions are limited to unary and binary arithmetic, or variable names supported operators: + - / * % ^ (plus, minus, divide, multiple, modulo, exponent) print – syntax print expression. if the expression is a variable, and this variable is not in scope, then an error message indicating unknown variable x at line number y. the value printed if there is a variable in scope should be the variable with the closest scope. errors – other than the print statements, our interpreter will not be responsible for detecting errors, syntax errors should be disregarded if encountered, assume that the source file is correct. our hash function: sum the ordinal values of the characters of the variable multiplied by their position in the string (1-indexing), then taking the modulo by tablesize. ie. the variable abc = (65 * 1 + 66 * 2 + 67 * 3) % tablesize all tokens are separated by one space or a new line. output: for this assignment, run your interpreter on this sample source program as well as a program of your own, and turn it the output from both, as well as the source code from your borg program as well as source code of the assignment and its executable. zip is good. x-credit. each student may implement one additional feature to the language, such as adding if, methods, more capable print statements. sample program and its output: input output com here is our first borg program com what a robust language it is start var boramir = 25 var legolas = 101 print boramir boramir is 25 boramir ++ print legolas legolas is 101 print gandalf gandalf is undefined print boramir * 2 boaramir * 2 is 52 com com nested block com start var gandalf = 49 print gandalf gandalf is 49 print boramir boramir is 26 finish print gandalf gandalf is undefined start legolas = 1000 print legolas legolas is 1000 finish print legolas legolas is 1000 legolas -- print legolas legolas is 999 finish

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:30
Apower user needs you to install a second type of operating system on his computer to increase efficiency while running some specialized software programs. which installation technique should you use?
Answers: 3
question
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
You know the right answer?
Build a hash table using chaining as the collision resolution technique. insertions into the hash ta...
Questions
question
Mathematics, 10.02.2021 21:20
question
Mathematics, 10.02.2021 21:20
Questions on the website: 13722362