-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicroRLex.java
More file actions
31 lines (25 loc) · 745 Bytes
/
Copy pathMicroRLex.java
File metadata and controls
31 lines (25 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.*;
public class MicroRLex{
private static final int MAX_TOKENS = 1000;
public static void main(String args[]) throws IOException{
int i,n;
Token[] token = new Token[MAX_TOKENS];
MicroRLexer lexer = new MicroRLexer (new InputStreamReader (System.in));
System.out.println("Source Program");
System.out.println("--------------");
System.out.println();
n = -1;
do{
if (n< MAX_TOKENS)
token[++n] = lexer.nextToken();
else
ErrorMessage.print("Maximum number of tokens exceeded");
}while (token[n].symbol() != Symbol.EOF);
System.out.println();
System.out.println("List of Tokens");
System.out.println();
for (i = 0; i<n; i++)
System.out.println(token[i]);
System.out.println();
}
}