CS 316 (Kong): TinyJ Assignment 1. {<methoddecl>} } [ [<printargument>] )
|
|
- Theodora Nicholson
- 5 years ago
- Views:
Transcription
1 CS 316 (Kong): TinyJ Assignment 1 To be submitted no later than: Thursday, November 29. [Note: I expect euclid to be up until midnight that evening, but there is no guarantee that it will be: If euclid unexpectedly goes down after 6 p.m., the deadline will not be extended. If you try to submit after 6 p.m. that evening and find that euclid is down, you may have to make a late submission!] This assignment counts 1.5% towards your grade if the grade is computed using rule A. The TinyJ language is an extremely small subset of Java. Every valid TinyJ program is a valid Java program, and has the same semantics whether it is regarded as a TinyJ or a Java program. The syntax of TinyJ is given by the following EBNF rules: A Java program is a TinyJ program if and only if it can be generated by these EBNF rules, except that TinyJ doesn t support non-decimal (i.e., hexadecimal, octal, or binary) integer literals, method name overloading, program arguments, printing of Boolean values, return; statements within the main() method, and ints that are ³ ,147,418,112. Reserved words of TinyJ are shown in boldface. Some names used by Java library packages, classes, and their methods (e.g., java, Scanner, and nextint) are reserved words of TinyJ, as is main. Otherwise, IDENTIFIER here means any Java identifier consisting of ASCII characters. indicates a nonterminal whose method you must complete in Parser.java--other methods have already been written for you! <program> [<importstmt>] <importstmt> import java. util. Scanner ; <maindecl> <methoddecl> <parameterdecllist> <methoddecl> <maindecl> <datafielddecl> <vardecl> <singlevardecl> <parameterdecl> <compoundstmt> <statement> <assignmentorinvoc> <argumentlist> <ifstmt> <whilestmt> <outputstmt> class IDENTIFIER '' <datafielddecl> '' static <vardecl> int <singlevardecl>, <singlevardecl> ; Scanner IDENTIFIER new Scanner '(' IDENTIFIER '[' ']' [ <expr3> System. in ')' ; ] public static void main '(' String IDENTIFIER '[' ']' ')' <compoundstmt> static ( void int '[' ']') IDENTIFIER '(' <parameterdecllist> ')' <compoundstmt> [<parameterdecl>, <parameterdecl> ] '[' ']' '' ; return [<expr3>] ; <vardecl> <assignmentorinvoc> <compoundstmt> <ifstmt> <whilestmt> <outputstmt> IDENTIFIER ( '['<expr3>']' <expr3> ; <argumentlist> '('[<expr3>,<expr3>]')' if '(' <expr7> ')' <statement> [else <statement>] int '' IDENTIFIER <statement> while '(' <expr7> ')' System. out. ( ; ) <statement> print '(' <printargument> ')' ; println '(' [<printargument>] ')' ; ) <printargument> <expr7> <expr6> <expr5> <expr4> <expr3> <expr2> CHARSTRING <expr3> ' ' <expr6> & <expr5> <expr4> (!) <expr4> <expr3> [(> < > <) <expr3> ] <expr2> (+ ) <expr2> (* / %) '(' <expr7> ')' (+!) UNSIGNEDINT null new int '[' <expr3> ']' '[' ']' IDENTIFIER (. nextint '(' ')' [<argumentlist>]'[' <expr3> <expr6> <expr5> ']' This is the first of three TinyJ assignments. After completing all three assignments you will have a program that can compile any TinyJ program into a simple virtual machine code, and then execute the virtual machine code it has generated. (Execution should produce the same run-time behavior as you would get if you compiled the same TinyJ program using javac into a.class file and then executed that.class file using a Java VM.) There will be exam questions relating to the TinyJ assignments, which may count 25 50% towards your grade. Page 1 of 5 )
2 TinyJ Assignment 1 will not deal with compilation of TinyJ programs, nor with execution of virtual machine code, but only with syntax analysis of TinyJ programs. The goal of TinyJ Assignment 1 is to complete a program that will: (a) determine whether its input file is a <program> according to the above EBNF rules, and (b) output a parse tree of the input file, if the input file is a <program>. Regarding (a), note that a <program> is a syntactically valid TinyJ program, but may contain errors like undeclared variable or array index out of range. A sideways representation of ordered trees, described below, will be used for (b). A Sideways Representation of an Ordered Rooted Tree T If T has just one node, then Otherwise, representation of T the unique node of T representation of T the root of T representation of the 1st subtree of the root of T representation of the 2nd subtree of the root of T... representation of the last subtree of the root of T In this sideways representation, sibling nodes always have the same indentation, but each non-root node is further indented than its parent; the indentation of a node is proportional to the depth of that node in the tree. Here are the ordinary and the sideways representations of a tree: <expr4> <expr3> / \ <expr2> + <expr2> / / \ * UNSIGNEDINT IDENTIFIER UNSIGNEDINT <expr4> <expr3> <expr2> UNSIGNEDINT + <expr2> IDENTIFIER * UNSIGNEDINT Indentation level depth of node in the tree Indentation levels of consecutive lines are equal or differ by just 1: If previous line is a nonterminal, then the current line's indentation level is higher by 1. If previous line is a token/terminal, then the current line's indentation level is the same. If previous line is, the current line's indentation level is lower by 1. How to Install the TinyJ Assignment 1 Files on euclid, venus, and Your PC Do 1 5, and optionally 6 11, before our class on Monday, November 19. (See Seven Files You May Need to Refer to on p. 3.) Remember that Unix/Linux file and command names are case-sensitive when following the instructions below! 1. Login to euclid and enter: /users/kong300/316/tj1setup [The 1 in TJ1setup is the digit 1, not the letter l.] 2. Wait for the line TJ1setup done to appear on the screen, and then enter the following command on euclid: java -cp TJ1solclasses:. TJ1asn.TJ CS316ex12.java 12.sol Note the period after the colon in this command. This command executes my solution to this assignment with CS316ex12.java as the input file and 12.sol as the output file. A listing of CS316ex12.java should be displayed on the screen, and 12.sol should contain a sideways representation of the program s parse tree afterwards. There should not be any error message. To view the tree, you can use less 12.sol or just open 12.sol in an editor. 3. Logout from euclid and login to venus. 4. Enter the following on venus: /home/faculty/ykong/tj1setup [Again, the 1 in TJ1setup is the digit 1, not the letter l.] 5. Repeat step 2 above on venus. The following 6 steps are needed only if you are interested in doing TinyJ assignments on your PC rather than euclid or venus. (Regardless of where you do your work, you must submit on euclid.) These instructions assume you are using Oracle s JDK. Page 2 of 5
3 A Correct TinyJ Input File and the Corresponding Parse Tree That is Written to the Output File by a Solution to TinyJ Assignment 1 Input File (a TinyJ program): import java.util.scanner; class Simple2 static Scanner input new Scanner(System.in); public static void main(string args[]) int x input.nextint(); x x % 3; System.out.println(x + 2); Output File (the above program's parse tree, in sideways representation): <program> <importstmt> Reserved Word: import Reserved Word: java. Reserved Word: util. Reserved Word: Scanner ; Reserved Word: class IDENTIFIER: Simple2 <datafielddecl> Reserved Word: static <vardecl> Reserved Word: Scanner IDENTIFIER: input Reserved Word: new Reserved Word: Scanner ( Reserved Word: System. Reserved Word: in ) ; <maindecl> Reserved Word: public Reserved Word: static Reserved Word: void Reserved Word: main ( Reserved Word: String IDENTIFIER: args [ ] ) <compoundstmt> <statement> <vardecl> Reserved Word: int <singlevardecl> IDENTIFIER: x <expr3> <expr2> IDENTIFIER: input. Reserved Word: nextint ( ) ; <statement> <assignmentorinvoc> IDENTIFIER: x <expr3> <expr2> IDENTIFIER: x % UNSIGNED INTEGER LITERAL: 3 ; <statement> <outputstmt> Reserved Word: System. Reserved Word: out. Reserved Word: println ( <printargument> <expr3> <expr2> IDENTIFIER: x + <expr2> UNSIGNED INTEGER LITERAL: 2 ) ;
4 A TinyJ Input File with a Syntax Error, and the Output That is Generated by a Solution to TinyJ Assignment 1 Input File (the error is that public should be preceded by a semicolon): import java.util.scanner; class Simple2 static Scanner input new Scanner(System.in) public static void main(string args[]) int x input.nextint(); x x % 3; System.out.println(x + 2); Wrong token: Symbols.SEMICOLON expected, not Symbols.PUBLIC Output on the Screen (shows the tokens that are read before the error is detected): 1: 2: 3: 4: 5: 6: 7: import java.util.scanner; class Simple2 static Scanner input new Scanner(System.in) public ERROR! Something's wrong--maybe the following token is missing: ; input.currentchar ' ' LexicalAnalyzer.currentToken Reserved Word: public Output File (an incomplete parse tree whose leaves are the tokens that appear in the input file before the syntax error): <program> <importstmt> Reserved Word: import Reserved Word: java. Reserved Word: util. Reserved Word: Scanner ; Reserved Word: class IDENTIFIER: Simple2 <datafielddecl> Reserved Word: static <vardecl> Reserved Word: Scanner IDENTIFIER: input Reserved Word: new Reserved Word: Scanner ( Reserved Word: System. Reserved Word: in ) Last correct token: Symbols.RPAREN
5 Symbols.java.txt /23/2015 package TJlexer; import java.util.enumset; public enum Symbols // TinyJ reserved words INT("Reserved Word: int", "int"), VOID("Reserved Word: void", "void"), STATIC("Reserved Word: static", "static"), IF("Reserved Word: if", "if"), WHILE("Reserved Word: while", "while"), ELSE("Reserved Word: else", "else"), NEW("Reserved Word: new", "new"), OUT("Reserved Word: out", "out"), PRINT("Reserved Word: print", "print"), SYSTEM("Reserved Word: System", "System"), PRINTLN("Reserved Word: println", "println"), RETURN("Reserved Word: return", "return"), IN("Reserved Word: in", "in"), NULL("Reserved Word: null", "null"), NEXTINT("Reserved Word: nextint", "nextint"), MAIN("Reserved Word: main", "main"), JAVA("Reserved Word: java", "java"), UTIL("Reserved Word: util", "util"), CLASS("Reserved Word: class", "class"), STRING("Reserved Word: String", "String"), PUBLIC("Reserved Word: public", "public"), IMPORT("Reserved Word: import", "import"), SCANNER("Reserved Word: Scanner", "Scanner"), // End of TinyJ reserved words. (See the definition // Other TinyJ tokens that have just one instance LBRACE(""), RBRACE(""), COMMA(","), SEMICOLON(";"), BECOMES(""), LPAREN("("), RPAREN(")"), LBRACKET("["), RBRACKET("]"), DOT("."), OR(" "), AND("&"), NOT("!"), EQ(""), For each Symbols.X enum constant object, the field X.symbolRepresentationForOutputFile (see line 100) is set to the string passed as 1st argument of the constructor call for Symbols.X---see line 106. A call of TJ.output.printSymbol(Symbols.X) or a call of TJ.output.printSymbol(Symbols.X, null) will print the string X.symbolRepresentationForOutputFile to the output file as a node of the sideways parse tree (with the correct indentation). of the reservedwords EnumSet below.)
6 Symbols.java.txt NE("!"), GT(">"), LT("<"), GE(">"), LE("<"), TIMES("*"), DIV("/"), MOD("%"), PLUS("+"), MINUS("-"), // TinyJ tokens that have more than one instance IDENT("IDENTIFIER"), UNSIGNEDINT("UNSIGNED INTEGER LITERAL"), CHARSTRING("CHARACTER STRING LITERAL"), // Fictitious tokens ENDOFINPUT("EOF"), BADTOKEN("?????????? BAD TOKEN"), EMPTY("<empty>"), NONE(""), // Nonterminals NTprogram("<program>"), NTimport("<importStmt>"), NTdataFieldDecl("<dataFieldDecl>"), NTvarDecl("<varDecl>"), NTsingleVarDecl("<singleVarDecl>"), NTmainDecl("<mainDecl>"), NTmethodDecl("<methodDecl>"), NTparameterDeclList("<parameterDeclList>"), NTparameterDecl("<parameterDecl>"), NTcompoundStmt("<compoundStmt>"), NTstatement("<statement>"), NTassignmentOrInvoc("<assignmentOrInvoc>"), NTargumentList("<argumentList>"), NTifStmt("<ifStmt>"), NTwhileStmt("<whileStmt>"), NToutputStmt("<outputStmt>"), NTprintArgument("<printArgument>"), NTexpr7("<expr7>"), NTexpr6("<expr6>"), NTexpr5("<expr5>"), NTexpr4("<expr4>"), NTexpr3("<expr3>"), NTexpr2("<expr2>"), 11/23/2015
7 Symbols.java.txt NTexpr1(""); static final EnumSet<Symbols> reservedwords EnumSet.range(INT, SCANNER); public final String symbolrepresentationforoutputfile; final String reservedwordspelling; Symbols(String symbolrepresentationforoutputfile, String reservedwordspelling) this.symbolrepresentationforoutputfile symbolrepresentationforoutputfile; this.reservedwordspelling reservedwordspelling; Symbols(String symbolrepresentationforoutputfile) this(symbolrepresentationforoutputfile, null); 11/23/2015
8 A Correct TinyJ Input File and the Corresponding Parse Tree That is Written to the Output File by a Solution to TinyJ Assignment 1 <singlevardecl> IDENTIFIER: x import java.util.scanner; <expr3> <expr2> class Simple2 IDENTIFIER: input static Scanner input new Scanner(System.in);. Reserved Word: nextint public static void main(string args[]) ( ) int x input.nextint(); x x % 3; System.out.println(x + 2); ; Each line of the output file / parse tree is printed by 1 call of TJ.output.printSymbol(...) or by 1 call of TJ.output.decTreeDepth(). Output File (the above <statement> <assignmentorinvoc> program's parse tree, in IDENTIFIER: x sideways representation): <expr3> printed by calls of TJ.output.printSymbol(Symbols.IDENT, "x") printed by TJ.output.printSymbol(Symbols.NTprogram) <expr2> treedepth 0<program> <importstmt> printed by TJ.output.printSymbol(Symbols.NTimport) treedepth 1 IDENTIFIER: x treedepth 2 Reserved Word: import Reserved Word: java printed by TJ.output.printSymbol(Symbols.UNSIGNEDINT, 3). printed by TJ.output.printSymbol(Symbols.IMPORT, null) % Reserved Word: util UNSIGNED INTEGER LITERAL: 3. Reserved Word: Scanner ; printed by TJ.output.printSymbol(Symbols.SEMICOLON, null) printed by TJ.output.decTreeDepth() ; treedepth 1 Reserved Word: class IDENTIFIER: Simple2 printed by TJ.output.printSymbol(Symbols.LBRACE, null) <statement> <datafielddecl> <outputstmt> treedepth 2 Reserved Word: static printed by TJ.output.printSymbol(Symbols.NTvarDecl) Reserved Word: System <vardecl> treedepth 3. Reserved Word: Scanner Reserved Word: out IDENTIFIER: input printed by TJ.output.printSymbol(Symbols.NEW, null). Reserved Word: println Reserved Word: new ( Reserved Word: Scanner <printargument> ( <expr3> Reserved Word: System <expr2>. Reserved Word: in IDENTIFIER: x ) ; printed by TJ.output.decTreeDepth() treedepth 2 printed by TJ.output.decTreeDepth() + <expr2> treedepth 1 <maindecl> treedepth 2 Reserved Word: public UNSIGNED INTEGER LITERAL: 2 Reserved Word: static Reserved Word: void Reserved Word: main ( Reserved Word: String ) IDENTIFIER: args ; [ ] ) <compoundstmt> treedepth 3 <statement> treedepth 4 <vardecl> Reserved Word: int treedepth 5 Input File (a TinyJ program):
9 6. In a cmd.exe (command prompt) window* on your PC, enter the following: *You can open a cmd.exe window on your Windows PC as follows: md c:\316java 1. Type Win-r (i.e., hold down the Windows key and type r) to open the Run dialog box. 2. Type cmd into the Open: textbox and press E. 7. Enter javac -version in the cmd.exe window. If you get an error message or if the version number that is printed is older than 1.8.0, then download and install the latest version of the Java JDK e.g., the Java SE (LTS) JDK from and set the PATH variable as explained at The correct value of PATH for the Java SE JDK is typically: c:\program files\java\jdk \bin If you have difficulty with step 1 of these instructions for setting the PATH, try the following instead of that step: 1. Type Win-r to open the Run dialog box. 2. Type control sysdm.cpl into the Open: textbox and press E. 8. Make c:\316java your working directory by entering the following in the cmd.exe window: cd /d c:\316java 9. Using an scp or sftp client, download TJ1asn.jar from your home directory on venus or euclid into the c:\316java folder on your PC. For example, if the PuTTY programs have been installed in the c:\program Files (x86)\putty folder on a PC running a 64-bit version of Windows, or in the c:\program Files\PuTTY folder on a PC running a 32-bit version of Windows (which can be done, e.g., by downloading the file putty-0.70-installer.msi from and running that installer), and assuming c:\316java is your working directory in the cmd.exe window (see step 8), when you are connected to the Internet you can download TJ1asn.jar by entering the appropriate one of the following in the cmd.exe window: "c:\program files (x86)\putty\pscp" xxxxx316@euclid.cs.qc.cuny.edu:tj1asn.jar. "c:\program files\putty\pscp" xxxxx316@euclid.cs.qc.cuny.edu:tj1asn.jar. Here xxxxx316 means your euclid username. Note the double quotes in "c:\program... pscp" and the space followed by a period at the end of the line! 10. Enter the following two commands in the cmd.exe window: jar xvf TJ1asn.jar javac -cp. TJ1asn\TJ.java 11. Enter the following command in the cmd.exe window: java -cp TJ1solclasses;. TJ1asn.TJ CS316ex12.java 12.sol The comments on step 2 also apply here, except that a semicolon rather than a colon precedes the period. A version of less for Windows PCs is available at: Seven Files You May Be Expected to Refer to in Class Starting on Monday, November 19 Either bring a laptop / tablet to class so you can quickly bring any of these seven files up on your screen, or bring printouts of these seven files to class: From your TJ1asn directory on euclid: OutputFileHandler.java.txt Parser.java.txt SourceFileErrorException.java.txt TJ.java.txt From your TJlexer directory on euclid (the l in TJlexer is the letter l, not the digit 1): LexicalAnalyzer.java.txt SourceHandler.java.txt Symbols.java.txt These are the source files of the program, with line numbers added. The actual source files (without line numbers) are in the same directories and have the same names, but their extension is.java. If you have done steps 6 11 above, you can find the same files in C:\316java\TJ1asn and C:\316java\TJlexer on your PC, and these files can be opened using, e.g., any of the editors recommended in the last paragraph of p. 4 of the Lisp Assignment 2 document. Otherwise, you can the files to yourself e.g., you can send TJ1asn/TJ.java.txt to yourself by entering the following on euclid: pine -attach TJ1asn/TJ.java.txt your- -address [After pine starts up, enter Fx y to send the file.] How to Execute My Solution to This Assignment Steps 1 and 4 put 16 files named CS316exk.java (k 0 15) into your home directories on euclid and venus. These are all valid TinyJ source files. If you did step 10, it will have put copies of the same 16 files on your PC. You should be able to execute my solution to this assignment either on euclid or on venus by entering the following command: java -cp TJ1solclasses:. TJ1asn.TJ TinyJ-source-file-name output-file-name args[1] [Your current working directory has to be your home directory for this args[0] to work.] This should also work in a cmd.exe window on your PC if you have done steps 6 11, except that you need a semicolon instead of a colon after TJ1solclasses on a PC: java -cp TJ1solclasses;. TJ1asn.TJ TinyJ-source-file-name output-file-name [Your working directory has to be C:\316java for this to work (see step 8).] EXAMPLES: java java -cp -cp TJ1solclasses:. TJ1asn.TJ TJ1solclasses;. TJ1asn.TJ Page 3 of 5 CS316ex12.java CS316ex12.java 12.sol 12.sol (on euclid or venus) (on a PC)
10 How to Do TinyJ Assignment 1 The file TJ1asn/Parser.java is incomplete. It was produced by taking a complete version of that file and replacing parts of the code with comments of the follwing two forms: /*???????? */ or (in two places) /*???????? default: throw... */ To complete this assignment, replace every such comment in TJ1asn/Parser.java with appropriate code, and recompile the file. On venus or euclid, you can use any text editor to edit the file. If you are working on your PC, do not use Notepad as your editor; I suggest you use one of the editors listed in the last paragraph on p. 4 of the Lisp Assignment 2 document. (For the second type of comment, the appropriate code should include the default: throw... statement.) Do not put Parser.java or Parser.class into any directory other than TJ1asn..java and.class files. Do not change or move other To recompile TJ1asn/Parser.java after editing it, enter the following command: javac -cp. TJ1asn/Parser.java IMPORTANT: If you are doing this on venus or euclid, your current working directory has to be your home directory. If you are doing this on your PC (in a cmd.exe window), your working directory has to be c:\316java (see installation step 8); otherwise javac will not be able to find other classes that are used in Parser.java! As stated on p. 3 of the first-day handout, keep backups of your edited versions of Parser.java on venus and elsewhere. How to Test Your Solution Test your completed version of Parser.java by recompiling it, and then executing the TJ1asn.TJ program with each of the 16 files CS316exk.java (k 0 15) as the TinyJ source file and k.out as the output file. You can do this by entering the following two commands: args[1] javac -cp. TJ1asn/Parser.java args[0] java -cp. TJ1asn.TJ CS316exk.java k.out If you are doing this on venus or euclid, your current working directory has to be your home directory. If you are doing this on your PC (in a cmd.exe window), your working directory has to be c:\316java (see installation step 8). If your program is correct then in each case the output file k.out should be identical to the output file k.sol that is produced by running my solution with the same source file as follows: java -cp TJ1solclasses:. TJ1asn.TJ CS316exk.java k.sol [on euclid or venus] java -cp TJ1solclasses;. TJ1asn.TJ CS316exk.java k.sol [on a PC] On euclid and venus, use diff -c to compare the output files produced by your and my solutions. (This outputs a report of the differences, if any, between the two files.) On a PC, use fc /n to compare files. For example, the commands diff -c k.sol k.out > k.dif [on venus or euclid] and fc /n k.sol k.out > k.dif [on a PC] output to k.dif the differences between k.sol and k.out. (If your solution is correct, there should be no differences.) How to Submit a Solution to This Assignment This assignment is to be submitted no later than Thursday, November 29. It counts 1.5% towards your grade if the grade is computed using Rule A. [Note: If euclid unexpectedly goes down after 6 p.m. on the due date, the deadline will not be extended. Try to submit no later than noon that day, and on an earlier day if possible.] To submit: 1. Add a comment at the beginning of your completed version of Parser.java that gives your name and the names of the students you worked with (if any). As usual, you may work with up to two other students. 2. Leave your final version of Parser.java on euclid in your TJ1asn directory, so it replaces the original version of Parser.java, before midnight on the due date. When two or three students work together, each of the students must leave the completed file in his/her directory. If you are working on venus or your PC, you can transfer Parser.java to your TJ1asn directory on euclid by following the instructions on the next page. 3. Be sure to test your submission on euclid. Note that if your modified version of Parser.java cannot even be compiled without error on euclid, then you will receive no credit at all for your submission! IMPORTANT: Do NOT open your submitted file Parser.java in an editor on euclid after the due date, unless you are resubmitting a corrected version of your solution as a late submission. Also do not execute mv, chmod, or touch with your submitted file as an argument after the due date. (However, it is OK to view a submitted file using the less file viewer after the due date.) Remember that, as stated on page 3 of the first-day handout, you are required to keep a backup copy of your submitted file on venus, and another copy elsewhere. Page 4 of 5
11 3 examples of???????? comments in Parser.java that you need to replace with appropriate 11/17/2007 code. Parser.java.txt private static void outputstmt() throws SourceFileErrorException TJ.output.printSymbol(NToutputStmt); accept(system); accept(dot); accept(out); accept(dot); switch (getcurrenttoken()) /*???????? default: throw new SourceFileErrorException("print() or println() expected, not " + getcurrenttoken().symbolrepresentationforoutputfile); */ private static void printargument() throws SourceFileErrorException TJ.output.printSymbol(NTprintArgument); /*???????? */ private static void expr7() throws SourceFileErrorException TJ.output.printSymbol(NTexpr7); /*???????? */ 7
12 TJ.java.txt /3/2007 package TJ1asn; import import import import TJlexer.SourceHandler; TJlexer.LexicalAnalyzer; TJlexer.Symbols; java.io.printwriter; public final class TJ public static SourceHandler input; public static OutputFileHandler output; the "TJ.output" in TJ.output.printSymbol(...) etc. public static final int DATA_MEMORY_SIZE 20000; public static final int data[] new int [DATA_MEMORY_SIZE]; /* space for string literals */ public static void main(string args[]) final String inputfilename args.length 0? null : args[0]; final String outputfilename args.length < 1? null : args[1]; try output new OutputFileHandler(outputFileName); input new SourceHandler(inputFileName); LexicalAnalyzer.setIO(input, output); LexicalAnalyzer.setStringTable(data); LexicalAnalyzer.nextToken(); Parser.program(); The most important line: This tries to read a <program> from the input file and output the parse tree of that <program>. if (LexicalAnalyzer.getCurrentToken()! Symbols.ENDOFINPUT) throw new SourceFileErrorException("Token encountered after end of program"); catch (SourceFileErrorException theerror) System.out.println("\n\n\nERROR! " + theerror.errormessage); if (input! null) Error messages are if (input.getcurrentchar()! SourceHandler.eofDesignator) System.out.println("input.currentChar '" + (char) input.getcurrentchar() + '\''); printed to the screen by else this exception handler. System.out.println("input.currentChar EOF"); System.out.print("LexicalAnalyzer.currentToken "); TJ.output.outputSymbol(LexicalAnalyzer.getCurrentToken(), LexicalAnalyzer.getTokenValue(), new PrintWriter(System.out, true)); System.out.println(); finally if (output! null) 1
13 A TinyJ Input File with a Syntax Error, and the Output That is Generated by a Solution to TinyJ Assignment 1 Input File (the error is that public should be preceded by a semicolon): import java.util.scanner; class Simple2 static Scanner input new Scanner(System.in) public static void main(string args[]) int x input.nextint(); x x % 3; System.out.println(x + 2); Output on the Screen (shows the tokens that are read before the error is detected): 1: 2: 3: 4: 5: 6: 7: import java.util.scanner; class Simple2 static Scanner input new Scanner(System.in) public ERROR! Something's wrong--maybe the following token is missing: ; input.currentchar ' ' LexicalAnalyzer.currentToken Reserved Word: public Output File (an incomplete parse tree whose leaves are the tokens that appear in the input file before the syntax error): <program> <importstmt> Reserved Word: import Reserved Word: java. Reserved Word: util. Reserved Word: Scanner ; Reserved Word: class IDENTIFIER: Simple2 <datafielddecl> Reserved Word: static <vardecl> Reserved Word: Scanner IDENTIFIER: input Reserved Word: new Reserved Word: Scanner ( Reserved Word: System. Reserved Word: in )
14 Parser.java.txt /17/2007 package TJ1asn; import import import import static TJlexer.LexicalAnalyzer.getCurrentToken; static TJlexer.LexicalAnalyzer.nextToken; static TJlexer.Symbols.*; TJlexer.Symbols; // ************************************ Recursive Descent Parser ************************************** public final class Parser private static void accept (Symbols expectedtoken) throws SourceFileErrorException if (getcurrenttoken() expectedtoken) nexttoken(); else throw new SourceFileErrorException("Something's wrong--maybe the following token is missing: " + expectedtoken.symbolrepresentationforoutputfile); static void program () throws SourceFileErrorException TJ.output.printSymbol(NTprogram); if (getcurrenttoken() IMPORT) importstmt(); accept(class); accept(ident); accept(lbrace); while (getcurrenttoken() STATIC) datafielddecl(); maindecl(); while (getcurrenttoken() STATIC) methoddecl(); accept(rbrace); private static void importstmt() throws SourceFileErrorException 1
15 OutputFileHandler.java.txt /3/2007 package TJ1asn; import java.io.*; import java.util.scanner; import TJlexer.Symbols; public class OutputFileHandler protected PrintWriter outfilewriter; public final PrintWriter getoutfilewriter() return outfilewriter; protected int treedepth 0; public final int gettreedepth() return treedepth; public final void inctreedepth() treedepth++; public final void dectreedepth() for (int i 0; i < treedepth; i++) outfilewriter.print(" "); outfilewriter.println(""); treedepth--; public final void printsymbol(symbols nodename) printsymbol(nodename, null); called by Parser.java's parsing methods to print nonterminals public final void printsymbol(symbols nodename, Object nodevalue) if (nodename! Symbols.NONE) for (int i 0; i < treedepth; i++) prints treedepth spaces outfilewriter.print(" "); outputsymbol(nodename, nodevalue, outfilewriter); 1 called by nexttoken() to print currenttoken
16 OutputFileHandler.java.txt /3/2007 public void outputsymbol(symbols nodename, Object nodevalue, PrintWriter out) out.print(nodename.symbolrepresentationforoutputfile); if (nodevalue null) out.println(); else out.println(": " + nodevalue); protected final void openoutputfile (String filename) throws SourceFileErrorException System.out.print("Enter name for output file: "); if (filename! null) System.out.print(filename+"\n\n"); else System.out.flush(); filename (new Scanner(System.in)).nextLine(); System.out.println(); try outfilewriter new PrintWriter(new FileWriter(filename)); catch (IOException e) throw new SourceFileErrorException("Failed to open output file"); protected OutputFileHandler(String filename) throws SourceFileErrorException openoutputfile(filename); 2
17 LexicalAnalyzer.java.txt /23/2015 package TJlexer; import static TJlexer.Symbols.*; allows Symbols.SEMICOLON to be written as just SEMICOLON, etc. import TJ1asn.OutputFileHandler; import TJ1asn.SourceFileErrorException; public final class LexicalAnalyzer private static SourceHandler input; private static OutputFileHandler output; private static int stringtable[]; public static void setio(sourcehandler sourcehandler, OutputFileHandler outputfilehandler) input sourcehandler; output outputfilehandler; public static void setstringtable(int[] tbl) stringtable tbl; private static Symbols currenttoken NONE; currenttoken contains the Symbols.X constant which represents the TinyJ token that this program "is now looking at". public static Symbols getcurrenttoken() currenttokenneedstobeinspected false; return currenttoken; getcurrenttoken() is the public getter method for currenttoken. private static boolean currenttokenneedstobeinspected; private static int currentvalue; // numerical value of UNSIGNEDINT token public static int getcurrentvalue() return currentvalue; private static String currentspelling; public static String getcurrentspelling() return currentspelling; private static int startofstring; private static int endofstring -1; // spelling of IDENT
18 LexicalAnalyzer.java.txt /23/2015 public static int getstartofstring() return startofstring; public static int getendofstring() return endofstring; public static void setendofstring(int addr) // called in ParserAndTranslator's program() method endofstring addr; private static Object tokenvalue; // passed to output.printsymbol() at start of nexttoken(); // contains information used to output the currenttoken public static Object gettokenvalue() return tokenvalue; public static void nexttoken() throws SourceFileErrorException output.printsymbol(currenttoken, tokenvalue); if (currenttokenneedstobeinspected) throw new SourceFileErrorException("Internal error in parser: Token discarded without being inspected"); else A successful call of nexttoken() does the following: currenttokenneedstobeinspected true; StringBuilder currenttokenstring new StringBuilder(10); while (input.getcurrentchar() ' ') input.nextchar(); tokenvalue null; if (Character.isLetter((char) input.getcurrentchar()) input.getcurrentchar() '_' input.getcurrentchar() '$') /* identifier or reserved word */ 1. Prints currenttoken to the output file. 2. Skips white space, then reads the characters of the next token from the input file and sets currenttoken to the Symbols.X constant which represents that token. 3. Sets tokenvalue appropriately if that token is an identifier, a string literal, or an unsigned int literal; otherwise tokenvalue will be null (from line 81). do currenttokenstring.append((char) input.getcurrentchar()); input.nextchar(); while (Character.isLetterOrDigit((char) input.getcurrentchar()) input.getcurrentchar() '_' input.getcurrentchar() '$');
19 LexicalAnalyzer.java.txt currentspelling currenttokenstring.tostring(); for (Symbols resword : Symbols.reservedWords) if (currentspelling.equals(resword.reservedwordspelling)) currenttoken resword; return; currenttoken IDENT; tokenvalue currentspelling; return; /* identifier or reserved word */ else switch (input.getcurrentchar()) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* unsigned integer */ currenttoken UNSIGNEDINT; do currenttokenstring.append((char) input.getcurrentchar()); input.nextchar(); while (input.getcurrentchar() > '0' && input.getcurrentchar() < '9'); currentvalue Integer.parseInt(currentTokenString.toString()); tokenvalue currentvalue; return; case '"': currenttoken CHARSTRING; startofstring endofstring + 1; int linenum input.getsourcefilereader().getlinenumber(); input.nextchar(); int c; while ((c input.getcurrentchar())! '"') if (c SourceHandler.eofDesignator) throw new SourceFileErrorException("End of file occurred within a string."); else if (c '\\') input.nextchar(); switch (input.getcurrentchar()) case 'n': c '\n'; break; case '\\': c '\\'; break; case '"': c '\"'; break; 11/23/2015
20 LexicalAnalyzer.java.txt default: c input.getcurrentchar(); break; currenttokenstring.append((char) c); stringtable[++endofstring] c; input.nextchar(); if (input.getsourcefilereader().getlinenumber()! linenum) throw new SourceFileErrorException("Newline not allowed within a string."); tokenvalue '"' + currenttokenstring.tostring() + '"'; input.nextchar(); return; case '': input.nextchar(); if (input.getcurrentchar() '') currenttoken EQ; input.nextchar(); else currenttoken BECOMES; return; case '!': input.nextchar(); if (input.getcurrentchar() '') currenttoken NE; input.nextchar(); else currenttoken NOT; return; case '<': input.nextchar(); if (input.getcurrentchar() '') currenttoken LE; input.nextchar(); else currenttoken LT; return; 11/23/2015
21 LexicalAnalyzer.java.txt /23/2015 case '>': input.nextchar(); if (input.getcurrentchar() '') currenttoken GE; input.nextchar(); else currenttoken GT; return; case '+': input.nextchar(); if (input.getcurrentchar() '+') currenttoken BADTOKEN; tokenvalue "\"++\""; throw new SourceFileErrorException("Unrecognized token: " + tokenvalue); else currenttoken PLUS; return; case '-': input.nextchar(); if (input.getcurrentchar() '-') currenttoken BADTOKEN; tokenvalue "\"--\""; throw new SourceFileErrorException("Unrecognized token: " + tokenvalue); else currenttoken MINUS; return; case case case case case case case case case case case case case case '&': ' ': '': '': ',': ';': '(': ')': '[': ']': '.': '*': '/': '%': currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken currenttoken AND; input.nextchar(); return; OR; input.nextchar(); return; LBRACE; input.nextchar(); return; RBRACE; input.nextchar(); return; COMMA; input.nextchar(); return; SEMICOLON; input.nextchar(); return; LPAREN; input.nextchar(); return; RPAREN; input.nextchar(); return; LBRACKET; input.nextchar(); return; RBRACKET; input.nextchar(); return; DOT; input.nextchar(); return; TIMES; input.nextchar(); return; DIV; input.nextchar(); return; MOD; input.nextchar(); return;
22 LexicalAnalyzer.java.txt case SourceHandler.eofDesignator: currenttoken ENDOFINPUT; return; default: currenttoken BADTOKEN; tokenvalue "'" + (char) input.getcurrentchar() + "'"; throw new SourceFileErrorException("Unrecognized token: " + tokenvalue); /* nexttoken */ 11/23/2015
23 This is the file you have to complete. Parser.java.txt /17/2007 package TJ1asn; import import import import static TJlexer.LexicalAnalyzer.getCurrentToken; allows LexicalAnalyzer.getCurrentToken() to be written as just getcurrenttoken(). allows LexicalAnalyzer.nextToken() to be written as just nexttoken(). static TJlexer.LexicalAnalyzer.nextToken; static TJlexer.Symbols.*; allows Symbols.SEMICOLON to be written as just SEMICOLON, etc. TJlexer.Symbols; // ************************************ Recursive Descent Parser ************************************** public final class Parser private static void accept (Symbols expectedtoken) throws SourceFileErrorException if (getcurrenttoken() expectedtoken) nexttoken(); else throw new SourceFileErrorException("Something's wrong--maybe the following token is missing: " + expectedtoken.symbolrepresentationforoutputfile); A call of accept(x) does the following: static void program () throws SourceFileErrorException TJ.output.printSymbol(NTprogram); if (getcurrenttoken() IMPORT) importstmt(); accept(class); accept(ident); accept(lbrace); 1. It checks that currenttoken Symbols.X. 2. Assuming currenttoken Symbols.X it calls nexttoken(), which: (a) Prints token Symbols.X to the output file. (b) Reads in the next token from the input file and sets currenttoken (& tokenvalue) accordingly. But if currenttoken! Symbols.X when accept(x) is called, an exception is thrown and the program will terminate after printing an error message on the screen! while (getcurrenttoken() STATIC) datafielddecl(); maindecl(); Calling accept(x) has the same effect as calling nexttoken() unless currenttoken! Symbols.X, in which case the program terminates with an error message. while (getcurrenttoken() STATIC) methoddecl(); accept(rbrace); private static void importstmt() throws SourceFileErrorException 1
24 RECURSIVE DESCENT PARSING For each nonterminal <n> of the EBNF specification, Parser.java has a 11/17/2007 corresponding static parsing method n(). When n() is called, it expects currenttoken to be a possible first token* TJ.output.printSymbol(NTimport); of an instance of <n>. If this is so, then the call of n() will (if possible): accept(import); 1. Read in the tokens in the rest of an instance of <n>. accept(java); 2. Output (with an indentation of TJ.output.treeDepth) a sideways parse accept(dot); accept(util); tree, with root <n>, which generates the instance of <n> that is read. Parser.java.txt accept(dot); accept(scanner); accept(semicolon); On return from a successful call of n(), currenttoken will be the first token after the instance of <n> that it read. *If <n> can generate an empty string, as in the case <n> <parameterdecllist>, then when n() is called currenttoken might also be the first token after an empty sequence that is derived from <n>. private static void datafielddecl() throws SourceFileErrorException TJ.output.printSymbol(NTdataFieldDecl); accept(static); vardecl(); private static void vardecl() throws SourceFileErrorException TJ.output.printSymbol(NTvarDecl); if (getcurrenttoken() INT) nexttoken(); singlevardecl(); while (getcurrenttoken() COMMA) nexttoken(); singlevardecl(); accept(semicolon); else if (getcurrenttoken() SCANNER) nexttoken(); if (getcurrenttoken() IDENT) nexttoken(); 2
25 Parser.java.txt /17/2007 else throw new SourceFileErrorException("Scanner name expected"); accept(becomes); accept(new); accept(scanner); accept(lparen); accept(system); accept(dot); accept(in); accept(rparen); accept(semicolon); else throw new SourceFileErrorException("\"int\" or \"Scanner\" expected"); private static void singlevardecl() throws SourceFileErrorException TJ.output.printSymbol(NTsingleVarDecl); /*???????? */ private static void maindecl() throws SourceFileErrorException TJ.output.printSymbol(NTmainDecl); accept(public); accept(static); accept(void); accept(main); accept(lparen); accept(string); accept(ident); accept(lbracket); accept(rbracket); accept(rparen); 3
26 Parser.java.txt /17/2007 compoundstmt(); private static void methoddecl() throws SourceFileErrorException TJ.output.printSymbol(NTmethodDecl); /*???????? */ private static void parameterdecllist() throws SourceFileErrorException TJ.output.printSymbol(NTparameterDeclList); if (getcurrenttoken() INT) parameterdecl(); while (getcurrenttoken() COMMA) nexttoken(); parameterdecl(); else TJ.output.printSymbol(EMPTY); private static void parameterdecl() throws SourceFileErrorException TJ.output.printSymbol(NTparameterDecl); accept(int); accept(ident); while (getcurrenttoken() LBRACKET) nexttoken(); accept(rbracket); 4
27 Parser.java.txt /17/2007 private static void compoundstmt() throws SourceFileErrorException TJ.output.printSymbol(NTcompoundStmt); /*???????? */ private static void statement() throws SourceFileErrorException TJ.output.printSymbol(NTstatement); switch (getcurrenttoken()) case SEMICOLON: nexttoken(); break; case RETURN: nexttoken(); if (getcurrenttoken()! SEMICOLON) expr3(); accept(semicolon); break; case INT: case SCANNER: vardecl(); break; case IDENT: assignmentorinvoc(); break; case LBRACE: compoundstmt(); break; case IF: ifstmt(); break; case WHILE: whilestmt(); break; case SYSTEM: outputstmt(); break; default: throw new SourceFileErrorException("Expected first token of a <statement>, not " + getcurrenttoken().symbolrepresentationforoutputfile); private static void assignmentorinvoc() throws SourceFileErrorException TJ.output.printSymbol(NTassignmentOrInvoc); /*???????? */ 5
28 Parser.java.txt /17/2007 private static void argumentlist() throws SourceFileErrorException TJ.output.printSymbol(NTargumentList); /*???????? */ private static void ifstmt() throws SourceFileErrorException TJ.output.printSymbol(NTifStmt); accept(if); accept(lparen); expr7(); accept(rparen); statement(); if (getcurrenttoken() ELSE) nexttoken(); statement(); private static void whilestmt() throws SourceFileErrorException TJ.output.printSymbol(NTwhileStmt); /*???????? */ 6
29 Parser.java.txt /17/2007 private static void outputstmt() throws SourceFileErrorException TJ.output.printSymbol(NToutputStmt); accept(system); accept(dot); accept(out); accept(dot); switch (getcurrenttoken()) /*???????? default: throw new SourceFileErrorException("print() or println() expected, not " + getcurrenttoken().symbolrepresentationforoutputfile); */ private static void printargument() throws SourceFileErrorException TJ.output.printSymbol(NTprintArgument); /*???????? */ private static void expr7() throws SourceFileErrorException TJ.output.printSymbol(NTexpr7); /*???????? */ 7
30 Parser.java.txt /17/2007 private static void expr6() throws SourceFileErrorException TJ.output.printSymbol(NTexpr6); /*???????? */ private static void expr5() throws SourceFileErrorException TJ.output.printSymbol(NTexpr5); /*???????? */ private static void expr4() throws SourceFileErrorException TJ.output.printSymbol(NTexpr4); /*???????? */ private static void expr3() throws SourceFileErrorException TJ.output.printSymbol(NTexpr3); /*???????? */ private static void expr2() throws SourceFileErrorException TJ.output.printSymbol(NTexpr2); 8
31 Parser.java.txt /17/2007 expr1(); while ( getcurrenttoken() TIMES getcurrenttoken() DIV getcurrenttoken() MOD) nexttoken(); expr1(); private static void expr1() throws SourceFileErrorException TJ.output.printSymbol(NTexpr1); switch (getcurrenttoken()) /*???????? default: throw new SourceFileErrorException("Malformed expression"); */ 9
32 How to Transfer TJ1asn/Parser.java from venus or a PC to euclid s TJ1asn Directory The following instructions assume that xxxxx316 is your username on euclid. If you are working on venus, and your current working directory is your home directory, enter the following command to transfer TJ1asn/Parser.java to your TJ1asn directory on euclid: scp TJ1asn/Parser.java xxxxx316@euclid.cs.qc.cuny.edu:tj1asn You will be asked to enter your euclid password. If you are working on a PC that is running a 64-bit version of Windows and the PuTTY programs have been installed into the c:\program Files (x86)\putty folder, or you are working on a PC that is running a 32-bit version of Windows and the PuTTY programs* have been installed into the c:\program Files\PuTTY folder, then you can transfer TJ1asn/Parser.java into your TJ1asn directory on euclid by entering the appropriate one of the following commands in a cmd.exe window: 64-bit Windows: "c:\program files (x86)\putty\pscp" TJ1asn/Parser.java xxxxx316@euclid.cs.qc.cuny.edu:tj1asn 32-bit Windows: "c:\program files\putty\pscp" TJ1asn/Parser.java xxxxx316@euclid.cs.qc.cuny.edu:tj1asn The double quotes and the backslashes in "c:\program... pscp" are needed! You will be asked to enter your euclid password. IMPORTANT: After you have transferred TJ1asn/Parser.java to your TJ1asn directory on euclid, you should test your code on euclid see the How to Test Your Solution instructions on the previous page. (It is not enough to have tested your code on venus or your PC, because testing on a machine other than euclid does not test the file you actually submitted!) *You can get the PuTTY programs by downloading the installer file putty-0.70-installer.msi from and then running this installer on your PC. Page 5 of 5
33 A Mistake to Avoid When Doing TinyJ Assignment 1 A common mistake in writing recursive descent parsing code is to write getcurrenttoken() X or accept(x) [which performs a getcurrenttoken() X test] using a Symbols constant X that represents a nonterminal. This is wrong, as getcurrenttoken() returns a Symbols constant that represents a token. Here are two examples of this kind of mistake. 1. When writing the method argumentlist(), which should be based on the EBNF rule <argumentlist> '('[<expr3>,<expr3>]')' it would be wrong to write: accept(lparen); if (getcurrenttoken() NTexpr3) /* INCORRECT! */ expr3();... // a while loop that deals with,<expr3> accept(rparen); Here it would be correct to write code of the following form: accept(lparen); if (getcurrenttoken()! RPAREN) /* CORRECT */ expr3();... // a while loop that deals with,<expr3> accept(rparen); 2. When writing the method expr1(), one case you need to deal with relates to the following part of the EBNF rule that defines : IDENTIFIER (. nextint '(' ')' [<argumentlist>]'[' <expr3> ']' ) Here it would be wrong to write something like: case IDENT: nexttoken(); if (getcurrenttoken()! DOT) if (getcurrenttoken() NTargumentList /* INCORRECT! */ ) argumentlist();... // a while loop that deals with '[' <expr3> ']' else... // code to deal with. nextint '(' ')' break; Instead, you can write something like: case IDENT: nexttoken(); if (getcurrenttoken()! DOT) if (getcurrenttoken() LPAREN /* CORRECT */ ) argumentlist();... // a while loop that deals with '[' <expr3> ']' else... // code to deal with. nextint '(' ')' break; The use of LPAREN in the above code is correct because the first token of any instance of <argumentlist> must be a left parenthesis, as we see from the EBNF rule <argumentlist> '('[<expr3>,<expr3>]')'
CS 316 (Kong): TinyJ Assignment 1
CS 316 (Kong): TinyJ Assignment 1 To be submitted no later than: Thursday, May 3. [Note: I expect euclid to be up until midnight that evening, but there is no guarantee that it will be: If euclid unexpectedly
More informationThe TinyJ Compiler's Static and Stack-Dynamic Memory Allocation Rules Static Memory Allocation for Static Variables in TinyJ:
The TinyJ Compiler's Static and Stack-Dynamic Memory Allocation Rules Static Memory Allocation for Static Variables in TinyJ: The n th static int or array reference variable in a TinyJ source file is given
More informationMP 3 A Lexer for MiniJava
MP 3 A Lexer for MiniJava CS 421 Spring 2010 Revision 1.0 Assigned Tuesday, February 2, 2010 Due Monday, February 8, at 10:00pm Extension 48 hours (20% penalty) Total points 50 (+5 extra credit) 1 Change
More informationCS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)
CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going
More informationCS 6353 Compiler Construction Project Assignments
CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the
More informationMP 3 A Lexer for MiniJava
MP 3 A Lexer for MiniJava CS 421 Spring 2012 Revision 1.0 Assigned Wednesday, February 1, 2012 Due Tuesday, February 7, at 09:30 Extension 48 hours (penalty 20% of total points possible) Total points 43
More informationEDA180: Compiler Construc6on. Top- down parsing. Görel Hedin Revised: a
EDA180: Compiler Construc6on Top- down parsing Görel Hedin Revised: 2013-01- 30a Compiler phases and program representa6ons source code Lexical analysis (scanning) Intermediate code genera6on tokens intermediate
More informationCS 6353 Compiler Construction Project Assignments
CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the
More informationCSE 340 Fall 2014 Project 4
CSE 340 Fall 2014 Project 4 Due on Dec. 5, 2014 by 11:59 pm Abstract The goal of this project is to give you some hands-on experience with implementing a compiler. You will write a compiler for a simple
More informationProject 1: Scheme Pretty-Printer
Project 1: Scheme Pretty-Printer CSC 4101, Fall 2017 Due: 7 October 2017 For this programming assignment, you will implement a pretty-printer for a subset of Scheme in either C++ or Java. The code should
More informationPLT 4115 LRM: JaTesté
PLT 4115 LRM: JaTesté Andrew Grant amg2215@columbia.edu Jemma Losh jal2285@columbia.edu Jake Weissman jdw2159@columbia.edu March 7, 2016 Jared Weiss jbw2140@columbia.edu 1 Contents 1 Introduction 4 2 Lexical
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationLecture 12: Parser-Generating Tools
Lecture 12: Parser-Generating Tools Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (31/10/17) Lecture 12: Parser-Generating Tools 2017-2018 1 / 27 Summary Overview
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More informationFull file at
Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More information2.8. Decision Making: Equality and Relational Operators
Page 1 of 6 [Page 56] 2.8. Decision Making: Equality and Relational Operators A condition is an expression that can be either true or false. This section introduces a simple version of Java's if statement
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationTML Language Reference Manual
TML Language Reference Manual Jiabin Hu (jh3240) Akash Sharma (as4122) Shuai Sun (ss4088) Yan Zou (yz2437) Columbia University October 31, 2011 1 Contents 1 Introduction 4 2 Lexical Conventions 4 2.1 Character
More informationCS 116. Lab Assignment # 1 1
Points: 2 Submission CS 116 Lab Assignment # 1 1 o Deadline: Friday 02/05 11:59 PM o Submit on Blackboard under assignment Lab1. Please make sure that you click the Submit button and not just Save. Late
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics
WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java
More informationML 4 A Lexer for OCaml s Type System
ML 4 A Lexer for OCaml s Type System CS 421 Fall 2017 Revision 1.0 Assigned October 26, 2017 Due November 2, 2017 Extension November 4, 2017 1 Change Log 1.0 Initial Release. 2 Overview To complete this
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationClass 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017
Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief
More informationJavaCC: SimpleExamples
JavaCC: SimpleExamples This directory contains five examples to get you started using JavaCC. Each example is contained in a single grammar file and is listed below: (1) Simple1.jj, (2) Simple2.jj, (3)
More informationMore Assigned Reading and Exercises on Syntax (for Exam 2)
More Assigned Reading and Exercises on Syntax (for Exam 2) 1. Read sections 2.3 (Lexical Syntax) and 2.4 (Context-Free Grammars) on pp. 33 41 of Sethi. 2. Read section 2.6 (Variants of Grammars) on pp.
More informationASSIGNMENT 5 Objects, Files, and More Garage Management
ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationASSIGNMENT 5 Objects, Files, and a Music Player
ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you
More informationLab 2 Tutorial (An Informative Guide)
Lab 2 Tutorial (An Informative Guide) Jon Eyolfson University of Waterloo October 18 - October 22, 2010 Outline Introduction Good News Lexer and Parser Infrastructure Your Task Example Conclusion Jon Eyolfson
More informationMethods. Eng. Mohammed Abdualal
Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 8 Methods
More informationCMPSCI 187 / Spring 2015 Postfix Expression Evaluator
CMPSCI 187 / Spring 2015 Postfix Expression Evaluator Due on Thursday, 05 March, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015
More informationBCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE
COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting
More informationSimple Lexical Analyzer
Lecture 7: Simple Lexical Analyzer Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (03/10/17) Lecture 7: Simple Lexical Analyzer 2017-2018 1 / 1 Summary Use of jflex
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationA clarification on terminology: Recognizer: accepts or rejects strings in a language. Parser: recognizes and generates parse trees (imminent topic)
A clarification on terminology: Recognizer: accepts or rejects strings in a language Parser: recognizes and generates parse trees (imminent topic) Assignment 3: building a recognizer for the Lake expression
More informationOutline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.
OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce
More informationCS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer
CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer Assigned: Thursday, September 16, 2004 Due: Tuesday, September 28, 2004, at 11:59pm September 16, 2004 1 Introduction Overview In this
More informationObject-Oriented Programming in Java
CSCI/CMPE 3326 Object-Oriented Programming in Java Class, object, member field and method, final constant, format specifier, file I/O Dongchul Kim Department of Computer Science University of Texas Rio
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. File Input and Output
WIT COMP1000 File Input and Output I/O I/O stands for Input/Output So far, we've used a Scanner object based on System.in for all input (from the user's keyboard) and System.out for all output (to the
More informationPart II : Lexical Analysis
Part II : Lexical Analysis Regular Languages Translation from regular languages to program code A grammar for JO Context-free Grammar of JO Assignment 1 Martin Odersky, LAMP/DI 1 Regular Languages Definition
More informationCOMP 110 Project 1 Programming Project Warm-Up Exercise
COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,
More informationSoftware Installation for CS121
Software Installation for CS121 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University August 26, 2005 1 Installation of Java J2SE 5 SDK 1. Visit Start Settings Control Panel
More informationIntroduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017
Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 03: Control Flow Statements: Selection Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor
More informationSetting up your Computer
Setting up your Computer 1 Introduction On this lab, you will be getting your computer ready to develop and run Java programs. This lab will be covering the following topics: Installing Java JDK 1.8 or
More informationCS115. Chapter 17 Exception Handling. Prof. Joe X. Zhou Department of Computer Science. To know what is exception and what is exception handling
CS115 Pi Principles i of fcomputer Science Chapter 17 Exception Handling Prof. Joe X. Zhou Department of Computer Science CS115 ExceptionHandling.1 Objectives in Exception Handling To know what is exception
More informationUniversità degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware
More information4. Java Project Design, Input Methods
4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java
More informationOct Decision Structures cont d
Oct. 29 - Decision Structures cont d Programming Style and the if Statement Even though an if statement usually spans more than one line, it is really one statement. For instance, the following if statements
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationProject #1 Computer Science 2334 Fall 2008
Project #1 Computer Science 2334 Fall 2008 User Request: Create a Word Verification System. Milestones: 1. Use program arguments to specify a file name. 10 points 2. Use simple File I/O to read a file.
More informationSyntax Errors; Static Semantics
Dealing with Syntax Errors Syntax Errors; Static Semantics Lecture 14 (from notes by R. Bodik) One purpose of the parser is to filter out errors that show up in parsing Later stages should not have to
More informationName EID. (calc (parse '{+ {with {x {+ 5 5}} {with {y {- x 3}} {+ y y} } } z } ) )
CS 345 Spring 2010 Midterm Exam Name EID 1. [4 Points] Circle the binding instances in the following expression: (calc (parse '+ with x + 5 5 with y - x 3 + y y z ) ) 2. [7 Points] Using the following
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationCSE 401 Midterm Exam Sample Solution 2/11/15
Question 1. (10 points) Regular expression warmup. For regular expression questions, you must restrict yourself to the basic regular expression operations covered in class and on homework assignments:
More informationMIDTERM REVIEW. midterminformation.htm
MIDTERM REVIEW http://pages.cpsc.ucalgary.ca/~tamj/233/exams/ midterminformation.htm 1 REMINDER Midterm Time: 7:00pm - 8:15pm on Friday, Mar 1, 2013 Location: ST 148 Cover everything up to the last lecture
More informationLexical Analysis. Chapter 1, Section Chapter 3, Section 3.1, 3.3, 3.4, 3.5 JFlex Manual
Lexical Analysis Chapter 1, Section 1.2.1 Chapter 3, Section 3.1, 3.3, 3.4, 3.5 JFlex Manual Inside the Compiler: Front End Lexical analyzer (aka scanner) Converts ASCII or Unicode to a stream of tokens
More informationProgramming with Java
Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules
More informationMr. Monroe s Guide to Mastering Java Syntax
Mr. Monroe s Guide to Mastering Java Syntax Getting Started with Java 1. Download and install the official JDK (Java Development Kit). 2. Download an IDE (Integrated Development Environment), like BlueJ.
More informationIntroduction to Java Applications; Input/Output and Operators
www.thestudycampus.com Introduction to Java Applications; Input/Output and Operators 2.1 Introduction 2.2 Your First Program in Java: Printing a Line of Text 2.3 Modifying Your First Java Program 2.4 Displaying
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More information12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.
More informationProgramming Assignment 2 ( 100 Points )
Programming Assignment 2 ( 100 Points ) Due: Thursday, October 16 by 11:59pm This assignment has two programs: one a Java application that reads user input from the command line (TwoLargest) and one a
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Spring 2014 Name (print):. Instructions Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationMandatory Assignment 1, INF 4130, 2017
Mandatory Assignment 1, INF 4130, 2017 Deadline: Monday October 2. First: Read the general requirements for mandatory assignments at the department here: Norwegian: https://www.uio.no/studier/admin/obligatoriske-aktiviteter/mn-ifi-obliger-retningslinjer.html
More informationb. Suppose you enter input from the console, when you run the program. What is the output?
Part I. Show the printout of the following code: (write the printout next to each println statement if the println statement is executed in the program). a. Show the output of the following code: public
More informationJava for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B
Java for Python Programmers Comparison of Python and Java Constructs Reading: L&C, App B 1 General Formatting Shebang #!/usr/bin/env python Comments # comments for human readers - not code statement #
More informationProgramming in C++ 4. The lexical basis of C++
Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationTHE PROGRAMMING LANGUAGE NINC PARSER PROJECT. In this project, you will write a parser for the NINC programming language. 1.
THE PROGRAMMING LANGUAGE NINC PARSER PROJECT DR. GODFREY C. MUGANDA NORTH CENTRAL COLLEGE In this project, you will write a parser for the NINC programming language. 1. NINC Overview NINC contains three
More informationProgramming Languages. Dr. Philip Cannata 1
Programming Languages Dr. Philip Cannata 0 High Level Languages This Course Java (Object Oriented) Jython in Java Relation ASP RDF (Horn Clause Deduction, Semantic Web) Dr. Philip Cannata Dr. Philip Cannata
More informationChapter 4: Loops and Files
Chapter 4: Loops and Files Chapter Topics Chapter 4 discusses the following main topics: The Increment and Decrement Operators The while Loop Using the while Loop for Input Validation The do-while Loop
More informationCheck out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.
Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop
More informationDepartment of Computer Science University of Pretoria. Introduction to Computer Science COS 151
Department of Computer Science University of Pretoria Introduction to Computer Science COS 151 Practical 1 16 February 2018 1 Plagiarism Policy The Department of Computer Science considers plagiarism as
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationAP Computer Science Unit 1. Programs
AP Computer Science Unit 1. Programs Open DrJava. Under the File menu click on New Java Class and the window to the right should appear. Fill in the information as shown and click OK. This code is generated
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void
More informationCS 152: Data Structures with Java Hello World with the IntelliJ IDE
CS 152: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Electrical and Computer Engineering building
More informationThe input of your program is specified by the following context-free grammar:
CSE340 Spring 2018 Project 1: Lexical Analysis Due: Friday, February 2, 2018 by 11:59 pm MST Introduction The goal of this project is to show you how a description of a list of tokens can be used to automatically
More informationLecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value
Lecture Notes 1. Comments a. /* */ b. // 2. Program Structures a. public class ComputeArea { public static void main(string[ ] args) { // input radius // compute area algorithm // output area Actions to
More informationProgramming Assignment I Due Thursday, October 7, 2010 at 11:59pm
Programming Assignment I Due Thursday, October 7, 2010 at 11:59pm 1 Overview of the Programming Project Programming assignments I IV will direct you to design and build a compiler for Cool. Each assignment
More informationInterpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled
Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac
More informationCSE 413 Final Exam Spring 2011 Sample Solution. Strings of alternating 0 s and 1 s that begin and end with the same character, either 0 or 1.
Question 1. (10 points) Regular expressions I. Describe the set of strings generated by each of the following regular expressions. For full credit, give a description of the sets like all sets of strings
More informationpublic class Q1 { public int x; public static void main(string[] args) { Q1 a = new Q1(17); Q1 b = new Q1(39); public Q1(int x) { this.
CS 201, Fall 2013 Oct 2nd Exam 1 Name: Question 1. [5 points] What output is printed by the following program (which begins on the left and continues on the right)? public class Q1 { public int x; public
More informationPart III Appendices 165
Part III Appendices 165 Appendix A Technical Instructions Learning Outcomes This material will help you learn how to use the software you need to do your work in this course. You won t be tested on it.
More informationASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists
ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise
More informationDate: Dr. Essam Halim
Assignment (1) Date: 11-2-2013 Dr. Essam Halim Part 1: Chapter 2 Elementary Programming 1 Suppose a Scanner object is created as follows: Scanner input = new Scanner(System.in); What method do you use
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationFirst Java Program - Output to the Screen
First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the
More informationProgramming Assignment I Due Thursday, October 9, 2008 at 11:59pm
Programming Assignment I Due Thursday, October 9, 2008 at 11:59pm 1 Overview Programming assignments I IV will direct you to design and build a compiler for Cool. Each assignment will cover one component
More informationAssignment 4: Evaluation in the E Machine
Assignment 4: Evaluation in the E Machine 15-312: Foundations of Programming Languages Daniel Spoonhower (spoons@cs.cmu.edu) Edited by Jason Reed (jcreed@cs.cmu.edu) Out: Thursday, September 30, 2004 Due:
More informationJAVA PROGRAMMING (340)
Page 1 of 8 JAVA PROGRAMMING (340) REGIONAL 2016 Production Portion: Program 1: Base K Addition (335 points) TOTAL POINTS (335 points) Judge/Graders: Please double check and verify all scores and answer
More informationParser Combinators 11/3/2003 IPT, ICS 1
Parser Combinators 11/3/2003 IPT, ICS 1 Parser combinator library Similar to those from Grammars & Parsing But more efficient, self-analysing error recovery 11/3/2003 IPT, ICS 2 Basic combinators Similar
More informationFinal Exam. CSC 121 Fall Lecturer: Howard Rosenthal. Dec. 13, 2017
Your Name: Final Exam. CSC 121 Fall 2017 Lecturer: Howard Rosenthal Dec. 13, 2017 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationCS 426 Fall Machine Problem 1. Machine Problem 1. CS 426 Compiler Construction Fall Semester 2017
CS 426 Fall 2017 1 Machine Problem 1 Machine Problem 1 CS 426 Compiler Construction Fall Semester 2017 Handed Out: September 6, 2017. Due: September 21, 2017, 5:00 p.m. The machine problems for this semester
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationProgramming Assignment III
Programming Assignment III First Due Date: (Grammar) See online schedule (submission dated midnight). Second Due Date: (Complete) See online schedule (submission dated midnight). Purpose: This project
More information