- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRepl.java
More file actions
Latest commit
22 lines (19 loc) · 584 Bytes
/
Copy pathRepl.java
File metadata and controls
22 lines (19 loc) · 584 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
importjava.util.Scanner;
publicclassRepl {
publicstaticvoidmain(String[] args) throwsException {
Interpreteri = newInterpreter();
Scannersc = newScanner(System.in);
for (;;) {
try {
System.out.print("> ");
Stringexpr = sc.nextLine();
i.execute(expr);
} catch (java.util.NoSuchElementExceptione) {
sc.close();
break;
} catch (Exceptione) {
System.out.println(e.getMessage());
}
}
}
}