Find Jobs
Hire Freelancers

Create a lexical analyzer in Java

$10-30 USD

Em Andamento
Publicado há mais de 7 anos

$10-30 USD

Pago na entrega
1. In this project you will create a lexical analyzer in Java that identifies the following tokens in any string of characters. PLUS: + MINUS: - TIMES: * DIVIDE: / ASSIGNMENT: = LEFTPAREN: ( RIGHTPAREN: ) SEMICOLON: ; INTEGER: sequence of 1 or more digits FLOAT: sequence of digits with one decimal point. There must be at least one digit before and after the decimal point KEYWORD: read, write (lower-case letters) IDENTIFIER: lower-case letter followed by zero or more lower-case letters or digits Your lexical analyzer should find the tokens in an input string and print a token list that labels the tokens as to their type and value in the order found. The exact format of the input and output is listed below in item 3. If your program finds an unidentified character or any other error it should print a useful message (character and position number of the char) and exit the program. Notes: a. You must use the algorithm on the attached pseudocode. b. Do not assume that there are spaces separating any of the tokens c. To find an identifier read as many characters as possible. For example readme is not “read” + “me” it is “readme” For example x1=6 “x1” not “x” followed by an integer. It is “x1” d. To find a number read as many digits as possible. For example “2345” is the number 2345. e. The input string does not have to be a syntactically correct program. Your syntax analyzer should work on any string. It should never crash. If an error is detected it should gracefully exit with your won error message, printing only those tokens it has recognized up to the detected error. 2. Use object oriented programming (in Java) to develop your program. Create a class called LexAnalyzer. Create a main program that inputs the string to be analyzed, creates LexAnalyzer object and then calls the method prints the tokens as follows: String s = ″ x = 12.78 ; y = apple + 5 * orange;z=3*(4 * y) ″ ; [login to view URL](“Input String: “ + s); LexAnalyzer lex = new LexAnalyzer(s); [login to view URL](); 3. A typical test case should look like this: public static void main (String[] args) { String s=″ first = 5.62 ; z1=8*( 34 + art2b) read ″; [login to view URL](“Input String: “ + s); LexAnalyzer lex = new LexAnalyzer(s); [login to view URL]( “Token List”); [login to view URL]() ; } The output of the test case should look like this: Input String: first = 5.62 ; z1=8*( 34 + art2b) read Token List IDENTIFIER first ASSIGNMENT FLOAT 5.62 SEMICOLON IDENTIFIER z1 ASSIGNMENT INTEGER 8 TIMES LEFTPAREN INTEGER 34 PLUS IDENTIFIER art2b RIGHTPAREN KEYWORD read 4. Test your program thoroughly. Test good and bad strings, not just the examples below. Your instructor will run your program on a set of test cases which will not be known to you. At least 50% of your grade will be based on how well your program runs on the instructor test cases. 5. Submit your [login to view URL] program to Moodle on Sept 22 by 7:30 am. Your program must be named [login to view URL] and meet the conditions of the project. See attached for pseudocode needed and an outline of the program. 6. Hand in in class on Sept 22: (stapled together in this order) a. Title Page with course , project number, date and your name b. [login to view URL] source code c. Results for your program run on these test cases. Label test cases. Hand in the results of these test cases. //Test Case 1 ″x = 12.78 ; y = apple + 5 * orange;z=3*(4 * y) “ //Test Case 2 – ″read write 34 +5.678 -789.001 goodread+-* ″ //Test Case 3 – ″ int y = 7 ; double z = 78.01 ″ //Test Case 4 - ″ qwerty := 1234″ //Test Case 5 - ″ total is 23. dollars ″ //Test Case 6 - ″x = art2.1b″ //Test Case 7: ″   ″ //This is not an error. You should print EMPTY TOKEN LIST
ID do Projeto: 11568287

Sobre o projeto

2 propostas
Projeto remoto
Ativo há 8 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
We have a 1000+ employee in our company. So we can do any kind of project based on all languages and all stream...... We have 3 years+ experience employees for all stream especially C Programming, Javascript,html,php,java, android platform. So don't fear anything as soon as possible…. We are heartily welcome our projects.... ...................................................thank you..........................................................
$25 USD em 2 dias
0,0 (1 avaliação)
0,0
0,0
2 freelancers estão ofertando em média $50 USD for esse trabalho
Avatar do Usuário
Hello. It is really easy project, it's possible to complete it in few hours of pure working time.
$23 USD em 1 dia
4,9 (489 avaliações)
6,5
6,5
Avatar do Usuário
Hello there It is my great honor to apply for this vacant job. I am very hardworking and can work effectively as fast as I can. I have excellent skills in JAVA, C++, C#, OPPs, HTML5, CSS3, JS, AJAX, JQYERY, React.js, ANGULAR.JS, BACKBONE.JS, BOOTSTRAP, PHP,Wordpress, ASP.NET, MVC, Web Research and Microsoft Office and I have enough experience with different kinds of tasks as you can see in my "Work History", most of the time I gave my clients a great results.I have fast internet connection at home, have my own pc to use anytime and have own space to work. I can work fulltime and will focus to this project. I can follow instructions very well and will deliver the project on time. It is a pleasure if ever you will message me for an interview. I can work as soon as possible. Thanks and more power. MOHSAN IJAZ
$77 USD em 1 dia
5,0 (3 avaliações)
1,8
1,8

Sobre o cliente

Bandeira do(a) UNITED STATES
northridge, United States
5,0
11
Método de pagamento verificado
Membro desde nov. 10, 2015

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.