Share on Google+Share on Google+

samaya khan
java program...need help as soon as possible!!!
0 Answer(s)      6 years and 7 months ago
Posted in : Java Beginners
Modify the Lexer (15 points):
1. Use a command line argument for the input file for processing tokens ? do not use simple.x

2. Recognize the new tokens > void float
Be sure to change token file appropriately and then run TokenSetup as required

3. Include line number information within tokens for subsequent error reporting, etc.

4. Print each token with line number
READLINE: program { int i int j
program left: 0 right: 6 line: 1
{ left: 8 right: 8: line: 1
int left: 10 right: 12 line: 1
i left: 14 right: 14 line: 1
int left: 16 right: 18 line: 1
j left: 20 right: 20 line: 1

5. Output the source program with line numbers (since SourceReader reads the source lines it should save the program in memory for printout after the tokens are scanned):

1. program { int i int j
2. i = 2
3. j = 3
4. i = write(j+4)
5. }

If you encounter an error, e.g. you find a "%" on line 7 of the source file that contains 20 lines, then you should:
1. report the error
2. stop processing tokens at that point
3. echo the lines of the source file with line numbers up to and including the error line - e.g., echo lines 1 through 7 inclusive in the case with the "%" on line 7
4. exit

Comments on this lab..

1. TokenSetup should NOT be changed
2. The tokens file should be changed appropriately
3. Use the main method in for testing - DO NOT use other packages in the compiler (e.g. since there will always be complaints due to not recognizing the new constructs
4. Each character in the input stream should be accounted for - never ignored..
5. I will post your test case just prior to the due date.
6. REMOVE ALL DEBUG statements not required


View Answers

Related Tutorials/Questions & Answers:
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? file location SASLError using PLAIN: not-authorized


Advertisement null