subject

Lexical Analyzer Implementation

Use Java to write a simple Lexical Analyzer.

Input: a source code file, (.txt file). Ask user to input the file name.

Output: printing all recognized tokens

The source code accepted tokens include

Keywords: int double String (case sensitive)

operators: = ( ) + - * / , ;

identifier: letter(letter|digit)*

int constant

double constant

string constant: string constant is enclosed in a pair of "", such as "abc"

anything not recognized is detected as errors

If the input file has the following content:

int a, b=10;

a =bc*10-&(3.2+"abc";

The output should be

Line1:1 keyword: int

Line1: 5 identifier: a

Line1:6 operator: ,

Line1: 7 identifier: b

Line1: 8 operator: =

Line1: 9 int constant: 10

Line1: 11 operator: ;

Line2: 1 identifier: a

Line2: 3 operator: =

Line2: 4 identifier: bc

Line2: 6 operator: *

Line2: 7 int constant: 10

Line2: 9 operator: -

Line2: 10 error: & not recognized

Line2: 11 operator: (

Line2: 12 double constant: 3.2

Line2: 15 operator: +

Line2: 16 string constant: "abc"

Line2: 21 operator: ;

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:20, Korkot7633
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
image
Computers and Technology, 22.06.2019 18:30, emojigirl2824
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
image
Computers and Technology, 24.06.2019 01:00, gymnast8900
Me if you do then you get 10 points and brainliest
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, titalili0204
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
You know the right answer?
Lexical Analyzer Implementation

Use Java to write a simple Lexical Analyzer.

...

Questions in other subjects:

Konu
Mathematics, 20.04.2020 18:53
Konu
English, 20.04.2020 18:53
Konu
English, 20.04.2020 18:53