The document provides instructions for a coding assignment to write a lexical analyzer and symbol table for a class B that has one string attribute s initialized to "Hello", and two methods g that takes a string y argument and returns an integer, and f that takes an integer x argument and returns an integer. Students are asked to write the entire lexical analyzer with symbol table, code to display tokens and symbol table entries, and functions for inserting into, searching, and displaying the symbol table.
The document provides instructions for a coding assignment to write a lexical analyzer and symbol table for a class B that has one string attribute s initialized to "Hello", and two methods g that takes a string y argument and returns an integer, and f that takes an integer x argument and returns an integer. Students are asked to write the entire lexical analyzer with symbol table, code to display tokens and symbol table entries, and functions for inserting into, searching, and displaying the symbol table.
The document provides instructions for a coding assignment to write a lexical analyzer and symbol table for a class B that has one string attribute s initialized to "Hello", and two methods g that takes a string y argument and returns an integer, and f that takes an integer x argument and returns an integer. Students are asked to write the entire lexical analyzer with symbol table, code to display tokens and symbol table entries, and functions for inserting into, searching, and displaying the symbol table.
The document provides instructions for a coding assignment to write a lexical analyzer and symbol table for a class B that has one string attribute s initialized to "Hello", and two methods g that takes a string y argument and returns an integer, and f that takes an integer x argument and returns an integer. Students are asked to write the entire lexical analyzer with symbol table, code to display tokens and symbol table entries, and functions for inserting into, searching, and displaying the symbol table.
NOTE : Write Roll No, Name, Regn No in the answer sheet.
Duration 1 hour for write-up and 30 mins for uploading.
Class ‘B‘ has
One attribute named ‘s’ of type string is initialized. Two methods o ‘g’ which takes ‘y‘ as argument which is of type “string“ and has return type “int“ o ‘f‘ which takes ‘x‘ as argument which is integer type and returns an integer Write the entire lexical analyzer with symbol table. Write code for displaying list of tokens in token structure and symbol table entries for all identifiers. Symbol table has following columns class B { Serial Lexeme Type Arguments rtype s : String <- "Hello"; number Name g (y:String) : Int { ### g Method id,# int y.concat(s) … }; --Any characters between two dashes “--” and --the next newline are treated as comments. f (x:Int) : Int { x+1 }; };
Write the getnexttoken() to recognize all lexemes. Wite insert(), search() and display() functions for symbol table.