Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I ran the code on eclipse but the text file isn't reading as tokens? Please run the same code on eclipse and take screenshots of the code and the text file being read as tokens. 

Expert Solution
Step 1: Step

To address these points and ensure your code follows good practices, let's break it down:


Code Style:


Some good naming, some necessary comments (3)

Unit Tests:


At least one (3)

Main:


At least one of: Exists, reads file with GetAllBytes, calls lex, prints tokens (3)

Token class:


Has enum and string members (3)

Exists, members correct constructor correct (6)

String Handler:


Exists and holds string and index (3)

Lexer class:


Lexer- constructor (3)

Exists and loops over the string (3)

Two of: Accepts required characters, creates a token, doesn't accept characters it shouldn't (6)

Lexer - ProcessWord and ProcessNumber:


Accepts required characters, creates a token, doesn't accept characters it shouldn't (10)

Overall Lexing Process:


Exists, loops over the string, returns a LinkedList of tokens (6)

Skips appropriate values, calls ProcessWord and ProcessNumber, and adds their return values to the list (10)

To improve your code according to this checklist:


Make sure to use meaningful variable and method names.

Add comments where necessary, especially for complex logic and methods.

Write unit tests for your code to ensure it functions as expected.

Implement the required classes and methods, such as Lexer, Token, and StringHandler, according to the provided specifications.

Ensure that the lexing process follows the rules outlined in the original question.

Test your lexer with various input cases to verify its correctness.

If you have any specific questions or need assistance with a particular part of your code, feel free to ask

for help with that specific aspect.




trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education