Predrok 2025 - Naloga 1
This commit is contained in:
parent
1b45d6a0f9
commit
352085b499
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,3 @@ out/
|
|||||||
*.zip
|
*.zip
|
||||||
prg/**/*.ast
|
prg/**/*.ast
|
||||||
prg/**/*.out
|
prg/**/*.out
|
||||||
prg/**/*.pins25
|
|
26
grammar.txt
26
grammar.txt
@ -69,4 +69,28 @@ restinits -> COMMA initializer restinits | .
|
|||||||
initializer -> INTCONST intconstmult | CHARCONST | STRINGCONST .
|
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
prg/test.pins25
Normal file
5
prg/test.pins25
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// line1 --
|
||||||
|
line2 -----x
|
||||||
|
line3
|
||||||
|
|
||||||
|
fun main() = 0
|
@ -247,7 +247,13 @@ public class LexAn implements AutoCloseable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (buffChar != '\n' && buffChar != -1) {
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
while (buffChar != -1) {
|
||||||
|
if (buffChar == '\n' && !builder.toString().endsWith("--")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
builder.append((char) buffChar);
|
||||||
nextChar();
|
nextChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user