Author SHA1 Message Date
Gašper Dobrovoljc 352085b499 Predrok 2025 - Naloga 1 2025-06-04 14:14:46 +02:00
4 changed files with 33 additions and 28 deletions

No files matched your search

-1
View File
@@ -3,4 +3,3 @@ out/
*.zip *.zip
prg/**/*.ast prg/**/*.ast
prg/**/*.out prg/**/*.out
prg/**/*.pins25
+24
View File
@@ -70,3 +70,27 @@ initializer -> INTCONST intconstmult | CHARCONST | STRINGCONST .
intconstmult -> MUL const | . intconstmult -> MUL const | .
const -> INTCONST | CHARCONST | STRINGCONST . const -> INTCONST | CHARCONST | STRINGCONST .
--------------------------------------------------------------------
//LEFT ASOC.
exp0 = exp0 op other | other
|
v
exp0 = other exp0'
exp0' = op other exp0' | .
//RIGHT ASOC.
exp0 = other op exp0 | other
|
v
exp0 = other exp0'
exp0' = op exp0 | .
+5
View File
@@ -0,0 +1,5 @@
// line1 --
line2 -----x
line3
fun main() = 0
+4 -27
View File
@@ -247,38 +247,15 @@ public class LexAn implements AutoCloseable {
return; return;
} }
nextChar(); StringBuilder builder = new StringBuilder();
if (buffChar == '{') {
int depth = 1;
nextChar(); while (buffChar != -1) {
while (depth > 0) { if (buffChar == '\n' && !builder.toString().endsWith("--")) {
switch (buffChar) {
case '}':
nextChar();
if (buffChar != '/') continue;
nextChar();
if (buffChar != '/') continue;
depth--;
break; break;
case '/':
nextChar();
if (buffChar != '/') continue;
nextChar();
if (buffChar != '{') continue;
depth++;
break;
case -1:
throw new Report.Error(currentLocation(), "Unterminated multiline comment");
default:
nextChar();
} }
} builder.append((char) buffChar);
} else {
while (buffChar != '\n' && buffChar != -1) {
nextChar(); nextChar();
} }
}
nextToken(); nextToken();
return; return;