Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Project: Employ the UNIX utility to write a scanner for Subset Pascal whose grammar is given
Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Project: Employ the UNIX utility to write a scanner for Subset Pascal whose grammar is given in Table 1. Tokens are defined in Table 2 and Figures 1, 2, 3, and 4. An example program is given in Figure 5 and the corresponding output produced by the Subset Pascal scanner is shown in Figure 6. You are not required to produce an exact replica of the output shown in Figure 6, but you are required to print one line for every token recognized. For each token, you must print its tokencode, its location, the string of characters recognized, and its symbolic name. Project Files: Project Location: On the last page of this document, you can find a sample score sheet used to grade this project. Project 1 consists of source files that are identified below. You must name your source files exactly as shown below. Project files must be stored in the root directory of your student account. Failure to store project files in the root directory of your student account will result in a score of zero (O) for this project. File Description p01.cpp File p01.cpp contains functions which process command line arguments and invoke the scanner, repeatedly to find all the tokens in the input source file. pollex.h File pollex.h defines the interface to the Subset Pascal scanner. po1tkn.h File potkn.h contains the list of preprocessor definitions that define token codes. For example, #define PLUS 1 #define MINUS 2 Command Line: pollex. File pollex.l contains functions that accept the tokens of a Subset Pascal program. po1make File pomake contains instructions for program p01. Instructions are written for the UNIX utility make. File p01make creates the executable file poi from source files identified above. Project 1 can be invoked with zero or one program parameters. The first program parameter is the source file to be analyzed. Sample command lines together with corresponding actions by program p01 are shown below. Boldfaced type indicates data entered at the keyboard by the user. $ p01 Enter the source file name: gcd.pas $ p01 gcd.pas The input file name must have the suffix.pas. Input File Name: Input File: The input file can contain any sequence of characters. The scanner recognizes valid Subset Pascal Tokens and rejects invalid tokens. Sample test files are stored in the class directory. You can obtain copies of these files by issuing the following command when signed on to your student account on the department computer. $ cptt/cs4023/*.pas. Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Output File Name: The output file name has the same prefix as the input file but substitutes the suffix .tre for input file name suffix .pas. For example, if the input file name is gcd.pas, the output file name is god.trc. The output file should contain a list of the Subset Pascal tokens. Tokens and associated information is presented as shown in Figure 6. Output File: | id lid Rule No. LHS RHS program program-head program-declarations program-body program-head program id program-parameters; program-declarations declarations subprogram-declarations program-body compound-statement. program-parameters program-parameters (program-parameter-list) program-parameter-list identifier-list identifier-list 9 identifier-list identifier-list, id 10 declarations 11 declarations declarations var identifier-list : type: 12 type standard-type 13 type array (intlit .. intlit] of standard-type 14 standard-type id 15 subprogram-declarations 16 subprogram-declarations subprogram-declarations subprogram-declaration; 17 subprogram-declaration subprogram-head declarations compound-statement 18 subprogram-head function id subprogram-parameters: standard-type; 19 subprogram-head procedure id subprogram-parameters; 20 subprogram-parameters 21 subprogram-parameters (parameter-list) 22 parameter-list identifier-list : type 23 parameter-list parameter-list; identifier-list : type 24 compound-statement begin optional statements end 25 optional-statements 26 optional-statements statement-list 27 statement-list > statement 28 statement-list statement-list; statement 29 statement variable := expression 30 statement procedure-statement 31 statement > alternative-statement 32 statement iterative-statement 33 statement compound-statement Table 1. Subset Pascal Grammar. Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Rule Id LHS RHS 34 alternative-statement if-statement 35 iterative-statement while-statement 36 iterative-statement repeat-statement 37 iterative-statement for-statement 38 if-statement if expression then statement else statement 39 while-statement while expression do statement while-statement while expression do statement 40 repeat-statement repeat statement_list until expression 41 for-statement for variable := expression to expression do statement 42 for-statement for variable := expression downto expression do statement 43 variable 44 variable id [ expression ] 45 procedure-statement id 46 procedure-statement id (expression-list) 47 expression-list expression 48 expression-list expression-list, expression 49 expression simple-expression 50 expression simple-expression relop simple-expression 51 relop 52 relop 53 relop 54 relop 55 relop 56 relop > 57 simple-expression term 58 simple-expression sign term 59 sign 60 sign 61 simple-expression addop term addop 63 addop 64 addop 65 term factor 66 term term mulop factor 67 mulop 68 mulop mulop div 70 mulop mod 71 mulop and Table 1. Subset Pascal Grammar (continued). 62 69 Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Rule RHS Id 72 73 74 75 76 77 78 79 LHS factor factor factor factor factor factor factor factor id [ expression-list] id ( expression-list) expression) not factor intlit realit chrlit Table 1. Subset Pascal Grammar (continued). Comments Blanks Reserve words and identifiers Tokencodes Token AND ARRAY BEGAN DIV DO DOWNTO ELSE END FOR FUNCTION Comments are enclosed between { and }. They may not contain a { Comments may appear after any token. Blanks between tokens are optional, with the exception that reserve words and identifiers must be surrounded by blanks, newline characters, the beginning of the program, or punctuation. Reserve words and identifiers are case-insensitive. For example, Subset Pascal recognizes begin and Begin as the same token. Capitalization of letters in reserve words and identifiers is ignored. Assign a unique positive integer to each tokencode. Specification Token Specification and EQU array NEQ begin LES div LEQ do GRT downto GEQ else PLUS end MINUS for STAR function SLASH ASSIGN mod LPAREN RPAREN LBRACKET or RBRACKET procedure LCURLY program RCURLY repeat COLON then SEMICOLON COMMA until PERIOD var RANGE while APOSTROPHE ' Table 2. Subset Pascal Token Definitions not of MOD NOT OF OR PROCEDURE PROGRAM REPEAT THEN TO UNTIL VAR WHILE to Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner id (identifier) letter letter underscore digit underscore Figure 1. id (identifier) Examples ice_cream _myclass Principal intlit (integer literal) Figure 2. intlit (integer literal) Examples: 3 03 6272844 chrlit (character literal) o character 1 0 Figure 3. chrlit (character literal) Note: A single apostrophe is represented by two apostrophes is succession. Example character literals: 'begin' 'don't' realit (real literal) Figure 4. realit (real literal) Examples: 0.6 5E-8 49.22E+08 Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner 1E10 program examplelinput,output); var x,y: integer; function gcd(a,b:integer):integer; begin{gcd} if b=0 then ged:=a else ged:=gcd(b,a mod b) end{gcd}; begin{example} readin(x,y); write(gcd(x,y)) end{example). Figure 5. File gcd.pas Token:Code= 42 Name= PROGRAM line= 1 col= 1 Spelling="program" Token:Code= 50 Name= ID line= 1 col= 9 Spelling="example" Token:Code= 13 Name= LPAREN line= 1 col= 16 Spelling=" (" Token:Code= 50 Name= ID line= 1 col= 17 Spelling="input" Token:Code= 21 Name= COMMA line= 1 col= 22 Spelling="," Token:Code= 50 Name= ID line= 1 col= 23 Spelling="output." Token:Code= 14 Name= RPAREN line= 1 col= 29 Spelling=")" Token:Code= 20 Name= SEMICOLON line= 1 col= 30 Spelling=";" Token:Code= 47 Name= VAR line= 2 col= 3 Spelling="var" Taken:Code= 50 Name= ID line= 2 col= 7 Spelling="x" Token:Code= 21 Name= COMMA line= 2 col= 8 Spelling="," Token : Code= 50 Name= ID line= 2 col= 9 Spelling="y" Token:Code= 19 Name= COLON line 2 col= 10 Spelling=":" Token:Code= 50 Name= ID line= 2 col= 11 Spelling="integer" Token:Code= 20 Name= SEMICOLON line= 2 col= 18 Spelling=";" Token:Code- 35 Name- FUNCTION line 3 col- 3 Spelling-"function" Token : Code= 50 Name= ID line 3 col= 12 Spelling="god" Token:Code= 13 Name= LPAREN line 3 col= 15 Spelling="(" Token:Code 50 Name ID line 3 col- 16 Spelling -"a" Token:Code= 21 Name= COMMA line 3 col= 17 Spelling"," Token:Code= 50 Name= ID line= 3 col= 18 Spelling="b" Token:Code= 19 Name= COLON line 3 col= 19 Spelling=":" Token:Code= 50 Name= ID line= 3 col= 20 Spelling="integer" Token:Code= 14 Name= RPAREN line= 3 col= 27 Spelling=")" Token:Code= 19 Name= COLON liner 3 col= 28 Spelling=":" Token : Code= 50 Name= ID line= 3 col= 29 Spelling="integer" Token:Code= 20 Name= SEMICOLON line= 3 col= 36 Spelling=";" Token:Code= 28 Name= BEGIN line 4 col= 3 Spelling="begin" Token:Code= 36 Name= IF line= 5 col= 5 Spelling="if" Token:Code= 50 Name= ID liner 5 col- & Spelling="b" Token:Code= 2 Name= EQU line= 5 col= 9 Spelling="=" Token : Code= 51 Name= INTLIT line= 5 col= 10 Spelling="0" Token:Code= 44 Name= THEN line= 5 col= 12 Spelling="then" Token:Code= 50 Name= ID line= 5 col= 17 Spelling="god" Token:Code= 12 Name= ASSIGN line= 5 col= 20 Spelling=":=" Token:Code= 50 Name= ID line= 5 col= 22 Spelling="a" Figure 6. Subset Pascal Scanner output Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Token:Code= 32 Name= ELSE line= 6 col= 5 Spelling="else" Token:Code- 50 Name ID line 6 col- 10 Spelling -"god" Token:Code= 12 Name= ASSIGN line= 6 col= 13 Spelling=":-" Token:Code= 50 Name= ID line= 6 col= 15 Spelling="god" Token:Code= 13 Name= LPAREN line 6 col- 18 Spelling-" (" Token:Code= 50 Name= ID line= 6 col= 19 Spelling="b" Token:Code= 21 Name= COMMA line= 6 col= 20 Spelling="," Token:Code= 50 Name= ID line= 6 col= 21 Spelling="a" Token:Code= 37 Name= MOD line= 6 col= 23 Spelling="mod" Token:Code= 50 Name= ID line= 6 col= 27 Spelling="b" Token:Code= 14 Name= RPAREN line= 6 col= 28 Spelling=")" Token:Code= 33 Name= END line= 7 col= 3 Spelling="end" Token:Code= 20 Name= SEMICOLON line= 7 col= 11 Spelling=";" Token:Code= 28 Name= BEGIN line= 8 col= 1 Spelling="begin" Token:Code= 50 Name= ID liner 9 col= 3 Spelling="readln" Token:Code= 13 Name= LPAREN line= 9 col= 9 Spelling="(" Token : Code= 50 Name= ID line= 9 col= 10 Spelling="x" Token : Code= 21 Name= COMMA line= 9 col= 11 Spelling="," Token:Code= 50 Name= 9 col= 12 Spelling="y" Token:Code= 14 Name= RPAREN line 9 col= 13 Spelling=")" Token:Code- 20 Name- SEMICOLON line 9 col- 14 Spelling-";" Token:Code- 50 Name- ID line- 10 col- 3 Spelling-"write" Token:Code= 13 Name= LPAREN line= 10 col= 8 Spelling=" (" Token:Code= 50 Name= ID line= 10 col= 9 Spelling="god" Token : Code- 13 Name LPAREN line- 10 col- 12 Spelling-"(" Token:Code= 50 Name= ID line= 10 col= 13 Spelling="X" Token:Code= 21 Name= COMMA line= 10 col= 14 Spelling="," Token:Code- 50 Name- ID line- 10 col- 15 Spelling-"y" Token:Code= 14 Name= RPAREN line= 10 col= 16 Spelling=")" Token:Code= 14 Name= RPAREN line= 10 col= 17 Spelling=")" Token:Code= 33 Name= END line= il col= 1 Spelling="end" Token:Code= 22 Name= PERIOD line= 11 col= 13 Spelling="." Figure 6. Subset Pascal Scanner output (continued) Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Scoring Block Component Compilation Submission Instructions Author Identification Available Earned Explanation A zero (0) is recorded for the entire project if the project fails to compile without errors or warnings. 10 10 A zero (0) is recorded for this component if the project is stored in a folder other than the root directory of the project account. A zero (0) is recorded for this component if the project makefile fails to function correctly. A zero (0) is recorded for this component if any file name differs from specifications. A zero (0) is recorded if source files are not recorded in separately titled sections of this document. A zero (0) is recorded for this component if the author identification block is copied or completed incorrectly. A zero (0) is recorded for the component if the Scoring block is copied incorrectly. 55 A zero (0) is recorded for this component if any source file including the makefile does not have a complete author identification block for both team members. A zero (0) is recorded for this component if command line arguments are not processed according to project specifications. 15 A zero (0) is recorded for this component if the output file is not created or not named according to project specifications. 25 25 Five (5) points are subtracted from this component if comments are not properly managed. Up to five (5) points are subtracted from this component if all legal forms of character literals are not recognized and all illegal forms rejected. Up to five (5) points are subtracted from this component if all legal forms of real literals are not recognized and all illegal forms rejected. Up to five (5) points are subtracted from this component if all reserve words are not recognized. Up to five (5) points are subtracted from this component if all punctuation is not recognized. 50 50 Command Line Output file Execution Total Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Project: Employ the UNIX utility to write a scanner for Subset Pascal whose grammar is given in Table 1. Tokens are defined in Table 2 and Figures 1, 2, 3, and 4. An example program is given in Figure 5 and the corresponding output produced by the Subset Pascal scanner is shown in Figure 6. You are not required to produce an exact replica of the output shown in Figure 6, but you are required to print one line for every token recognized. For each token, you must print its tokencode, its location, the string of characters recognized, and its symbolic name. Project Files: Project Location: On the last page of this document, you can find a sample score sheet used to grade this project. Project 1 consists of source files that are identified below. You must name your source files exactly as shown below. Project files must be stored in the root directory of your student account. Failure to store project files in the root directory of your student account will result in a score of zero (O) for this project. File Description p01.cpp File p01.cpp contains functions which process command line arguments and invoke the scanner, repeatedly to find all the tokens in the input source file. pollex.h File pollex.h defines the interface to the Subset Pascal scanner. po1tkn.h File potkn.h contains the list of preprocessor definitions that define token codes. For example, #define PLUS 1 #define MINUS 2 Command Line: pollex. File pollex.l contains functions that accept the tokens of a Subset Pascal program. po1make File pomake contains instructions for program p01. Instructions are written for the UNIX utility make. File p01make creates the executable file poi from source files identified above. Project 1 can be invoked with zero or one program parameters. The first program parameter is the source file to be analyzed. Sample command lines together with corresponding actions by program p01 are shown below. Boldfaced type indicates data entered at the keyboard by the user. $ p01 Enter the source file name: gcd.pas $ p01 gcd.pas The input file name must have the suffix.pas. Input File Name: Input File: The input file can contain any sequence of characters. The scanner recognizes valid Subset Pascal Tokens and rejects invalid tokens. Sample test files are stored in the class directory. You can obtain copies of these files by issuing the following command when signed on to your student account on the department computer. $ cptt/cs4023/*.pas. Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Output File Name: The output file name has the same prefix as the input file but substitutes the suffix .tre for input file name suffix .pas. For example, if the input file name is gcd.pas, the output file name is god.trc. The output file should contain a list of the Subset Pascal tokens. Tokens and associated information is presented as shown in Figure 6. Output File: | id lid Rule No. LHS RHS program program-head program-declarations program-body program-head program id program-parameters; program-declarations declarations subprogram-declarations program-body compound-statement. program-parameters program-parameters (program-parameter-list) program-parameter-list identifier-list identifier-list 9 identifier-list identifier-list, id 10 declarations 11 declarations declarations var identifier-list : type: 12 type standard-type 13 type array (intlit .. intlit] of standard-type 14 standard-type id 15 subprogram-declarations 16 subprogram-declarations subprogram-declarations subprogram-declaration; 17 subprogram-declaration subprogram-head declarations compound-statement 18 subprogram-head function id subprogram-parameters: standard-type; 19 subprogram-head procedure id subprogram-parameters; 20 subprogram-parameters 21 subprogram-parameters (parameter-list) 22 parameter-list identifier-list : type 23 parameter-list parameter-list; identifier-list : type 24 compound-statement begin optional statements end 25 optional-statements 26 optional-statements statement-list 27 statement-list > statement 28 statement-list statement-list; statement 29 statement variable := expression 30 statement procedure-statement 31 statement > alternative-statement 32 statement iterative-statement 33 statement compound-statement Table 1. Subset Pascal Grammar. Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Rule Id LHS RHS 34 alternative-statement if-statement 35 iterative-statement while-statement 36 iterative-statement repeat-statement 37 iterative-statement for-statement 38 if-statement if expression then statement else statement 39 while-statement while expression do statement while-statement while expression do statement 40 repeat-statement repeat statement_list until expression 41 for-statement for variable := expression to expression do statement 42 for-statement for variable := expression downto expression do statement 43 variable 44 variable id [ expression ] 45 procedure-statement id 46 procedure-statement id (expression-list) 47 expression-list expression 48 expression-list expression-list, expression 49 expression simple-expression 50 expression simple-expression relop simple-expression 51 relop 52 relop 53 relop 54 relop 55 relop 56 relop > 57 simple-expression term 58 simple-expression sign term 59 sign 60 sign 61 simple-expression addop term addop 63 addop 64 addop 65 term factor 66 term term mulop factor 67 mulop 68 mulop mulop div 70 mulop mod 71 mulop and Table 1. Subset Pascal Grammar (continued). 62 69 Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Rule RHS Id 72 73 74 75 76 77 78 79 LHS factor factor factor factor factor factor factor factor id [ expression-list] id ( expression-list) expression) not factor intlit realit chrlit Table 1. Subset Pascal Grammar (continued). Comments Blanks Reserve words and identifiers Tokencodes Token AND ARRAY BEGAN DIV DO DOWNTO ELSE END FOR FUNCTION Comments are enclosed between { and }. They may not contain a { Comments may appear after any token. Blanks between tokens are optional, with the exception that reserve words and identifiers must be surrounded by blanks, newline characters, the beginning of the program, or punctuation. Reserve words and identifiers are case-insensitive. For example, Subset Pascal recognizes begin and Begin as the same token. Capitalization of letters in reserve words and identifiers is ignored. Assign a unique positive integer to each tokencode. Specification Token Specification and EQU array NEQ begin LES div LEQ do GRT downto GEQ else PLUS end MINUS for STAR function SLASH ASSIGN mod LPAREN RPAREN LBRACKET or RBRACKET procedure LCURLY program RCURLY repeat COLON then SEMICOLON COMMA until PERIOD var RANGE while APOSTROPHE ' Table 2. Subset Pascal Token Definitions not of MOD NOT OF OR PROCEDURE PROGRAM REPEAT THEN TO UNTIL VAR WHILE to Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner id (identifier) letter letter underscore digit underscore Figure 1. id (identifier) Examples ice_cream _myclass Principal intlit (integer literal) Figure 2. intlit (integer literal) Examples: 3 03 6272844 chrlit (character literal) o character 1 0 Figure 3. chrlit (character literal) Note: A single apostrophe is represented by two apostrophes is succession. Example character literals: 'begin' 'don't' realit (real literal) Figure 4. realit (real literal) Examples: 0.6 5E-8 49.22E+08 Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner 1E10 program examplelinput,output); var x,y: integer; function gcd(a,b:integer):integer; begin{gcd} if b=0 then ged:=a else ged:=gcd(b,a mod b) end{gcd}; begin{example} readin(x,y); write(gcd(x,y)) end{example). Figure 5. File gcd.pas Token:Code= 42 Name= PROGRAM line= 1 col= 1 Spelling="program" Token:Code= 50 Name= ID line= 1 col= 9 Spelling="example" Token:Code= 13 Name= LPAREN line= 1 col= 16 Spelling=" (" Token:Code= 50 Name= ID line= 1 col= 17 Spelling="input" Token:Code= 21 Name= COMMA line= 1 col= 22 Spelling="," Token:Code= 50 Name= ID line= 1 col= 23 Spelling="output." Token:Code= 14 Name= RPAREN line= 1 col= 29 Spelling=")" Token:Code= 20 Name= SEMICOLON line= 1 col= 30 Spelling=";" Token:Code= 47 Name= VAR line= 2 col= 3 Spelling="var" Taken:Code= 50 Name= ID line= 2 col= 7 Spelling="x" Token:Code= 21 Name= COMMA line= 2 col= 8 Spelling="," Token : Code= 50 Name= ID line= 2 col= 9 Spelling="y" Token:Code= 19 Name= COLON line 2 col= 10 Spelling=":" Token:Code= 50 Name= ID line= 2 col= 11 Spelling="integer" Token:Code= 20 Name= SEMICOLON line= 2 col= 18 Spelling=";" Token:Code- 35 Name- FUNCTION line 3 col- 3 Spelling-"function" Token : Code= 50 Name= ID line 3 col= 12 Spelling="god" Token:Code= 13 Name= LPAREN line 3 col= 15 Spelling="(" Token:Code 50 Name ID line 3 col- 16 Spelling -"a" Token:Code= 21 Name= COMMA line 3 col= 17 Spelling"," Token:Code= 50 Name= ID line= 3 col= 18 Spelling="b" Token:Code= 19 Name= COLON line 3 col= 19 Spelling=":" Token:Code= 50 Name= ID line= 3 col= 20 Spelling="integer" Token:Code= 14 Name= RPAREN line= 3 col= 27 Spelling=")" Token:Code= 19 Name= COLON liner 3 col= 28 Spelling=":" Token : Code= 50 Name= ID line= 3 col= 29 Spelling="integer" Token:Code= 20 Name= SEMICOLON line= 3 col= 36 Spelling=";" Token:Code= 28 Name= BEGIN line 4 col= 3 Spelling="begin" Token:Code= 36 Name= IF line= 5 col= 5 Spelling="if" Token:Code= 50 Name= ID liner 5 col- & Spelling="b" Token:Code= 2 Name= EQU line= 5 col= 9 Spelling="=" Token : Code= 51 Name= INTLIT line= 5 col= 10 Spelling="0" Token:Code= 44 Name= THEN line= 5 col= 12 Spelling="then" Token:Code= 50 Name= ID line= 5 col= 17 Spelling="god" Token:Code= 12 Name= ASSIGN line= 5 col= 20 Spelling=":=" Token:Code= 50 Name= ID line= 5 col= 22 Spelling="a" Figure 6. Subset Pascal Scanner output Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Token:Code= 32 Name= ELSE line= 6 col= 5 Spelling="else" Token:Code- 50 Name ID line 6 col- 10 Spelling -"god" Token:Code= 12 Name= ASSIGN line= 6 col= 13 Spelling=":-" Token:Code= 50 Name= ID line= 6 col= 15 Spelling="god" Token:Code= 13 Name= LPAREN line 6 col- 18 Spelling-" (" Token:Code= 50 Name= ID line= 6 col= 19 Spelling="b" Token:Code= 21 Name= COMMA line= 6 col= 20 Spelling="," Token:Code= 50 Name= ID line= 6 col= 21 Spelling="a" Token:Code= 37 Name= MOD line= 6 col= 23 Spelling="mod" Token:Code= 50 Name= ID line= 6 col= 27 Spelling="b" Token:Code= 14 Name= RPAREN line= 6 col= 28 Spelling=")" Token:Code= 33 Name= END line= 7 col= 3 Spelling="end" Token:Code= 20 Name= SEMICOLON line= 7 col= 11 Spelling=";" Token:Code= 28 Name= BEGIN line= 8 col= 1 Spelling="begin" Token:Code= 50 Name= ID liner 9 col= 3 Spelling="readln" Token:Code= 13 Name= LPAREN line= 9 col= 9 Spelling="(" Token : Code= 50 Name= ID line= 9 col= 10 Spelling="x" Token : Code= 21 Name= COMMA line= 9 col= 11 Spelling="," Token:Code= 50 Name= 9 col= 12 Spelling="y" Token:Code= 14 Name= RPAREN line 9 col= 13 Spelling=")" Token:Code- 20 Name- SEMICOLON line 9 col- 14 Spelling-";" Token:Code- 50 Name- ID line- 10 col- 3 Spelling-"write" Token:Code= 13 Name= LPAREN line= 10 col= 8 Spelling=" (" Token:Code= 50 Name= ID line= 10 col= 9 Spelling="god" Token : Code- 13 Name LPAREN line- 10 col- 12 Spelling-"(" Token:Code= 50 Name= ID line= 10 col= 13 Spelling="X" Token:Code= 21 Name= COMMA line= 10 col= 14 Spelling="," Token:Code- 50 Name- ID line- 10 col- 15 Spelling-"y" Token:Code= 14 Name= RPAREN line= 10 col= 16 Spelling=")" Token:Code= 14 Name= RPAREN line= 10 col= 17 Spelling=")" Token:Code= 33 Name= END line= il col= 1 Spelling="end" Token:Code= 22 Name= PERIOD line= 11 col= 13 Spelling="." Figure 6. Subset Pascal Scanner output (continued) Programming Languages CMSC 4023 Project 1 Subset Pascal Scanner Scoring Block Component Compilation Submission Instructions Author Identification Available Earned Explanation A zero (0) is recorded for the entire project if the project fails to compile without errors or warnings. 10 10 A zero (0) is recorded for this component if the project is stored in a folder other than the root directory of the project account. A zero (0) is recorded for this component if the project makefile fails to function correctly. A zero (0) is recorded for this component if any file name differs from specifications. A zero (0) is recorded if source files are not recorded in separately titled sections of this document. A zero (0) is recorded for this component if the author identification block is copied or completed incorrectly. A zero (0) is recorded for the component if the Scoring block is copied incorrectly. 55 A zero (0) is recorded for this component if any source file including the makefile does not have a complete author identification block for both team members. A zero (0) is recorded for this component if command line arguments are not processed according to project specifications. 15 A zero (0) is recorded for this component if the output file is not created or not named according to project specifications. 25 25 Five (5) points are subtracted from this component if comments are not properly managed. Up to five (5) points are subtracted from this component if all legal forms of character literals are not recognized and all illegal forms rejected. Up to five (5) points are subtracted from this component if all legal forms of real literals are not recognized and all illegal forms rejected. Up to five (5) points are subtracted from this component if all reserve words are not recognized. Up to five (5) points are subtracted from this component if all punctuation is not recognized. 50 50 Command Line Output file Execution Total
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started