1 package de.lathanda.eos.baseparser;
3 import de.lathanda.eos.vm.Command;
4 import de.lathanda.eos.vm.Marker;
5 import de.lathanda.eos.vm.ProgramNode;
7 import java.util.ArrayList;
18 private final ArrayList<Node> sequence;
22 this.sequence =
new ArrayList<>();
26 this.sequence =
new ArrayList<>();
27 this.sequence.addAll(sequence);
31 for (
Node n : s.sequence) {
47 ArrayList<ProgramNode> temp =
new ArrayList<ProgramNode>(sequence.size());
48 sequence.forEach(i -> temp.add(i));
53 public void compile(ArrayList<Command> ops,
boolean autoWindow)
throws Exception {
54 for (
Node instruction : sequence) {
55 if (instruction.getType().isVoid()) {
61 instruction.compile(ops, autoWindow);
68 sequence.stream().forEachOrdered((instruction) -> {
69 instruction.resolveNamesAndTypes(with, env);
70 if (!instruction.getType().isVoid()) {
71 env.addError(instruction.getMarker(),
"StatementWithReturn", instruction);
78 StringBuilder res =
new StringBuilder();
80 res.append(n).append(
"\n");
82 return res.toString();
void resolveNamesAndTypes(Expression with, Environment env)
ArrayList< ProgramNode > getInstructions()
Sequence(List< Node > sequence)
void compile(ArrayList< Command > ops, boolean autoWindow)
void extend(Marker marker)