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, 22.06.2019 16:30
The most common battery cable terminal is a that provides a large surface contact area with the ability to tighten the terminal onto the battery post using a nut and bolt.
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e nĂŁo consigo tira-la no chorme
Answers: 2
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
You know the right answer?
Build a hash table using chaining as the collision resolution technique. insertions into the hash ta...
Questions
question
Chemistry, 14.12.2021 16:50
question
Mathematics, 14.12.2021 16:50
question
Mathematics, 14.12.2021 16:50
question
English, 14.12.2021 17:00
question
Mathematics, 14.12.2021 17:00
Questions on the website: 13722367