refactor packages, add package-info
This commit is contained in:
parent
846df01b11
commit
ec8617354e
|
@ -7,6 +7,7 @@ import org.antlr.v4.runtime.tree.ParseTreeProperty;
|
||||||
|
|
||||||
import pp.iloc.model.Reg;
|
import pp.iloc.model.Reg;
|
||||||
import pp.s1184725.boppi.type.*;
|
import pp.s1184725.boppi.type.*;
|
||||||
|
import pp.s1184725.boppi.symboltable.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class holds properties of all AST nodes during compilation.
|
* This class holds properties of all AST nodes during compilation.
|
||||||
|
|
|
@ -10,6 +10,7 @@ import pp.s1184725.boppi.antlr.*;
|
||||||
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
||||||
import pp.s1184725.boppi.exception.*;
|
import pp.s1184725.boppi.exception.*;
|
||||||
import pp.s1184725.boppi.type.*;
|
import pp.s1184725.boppi.type.*;
|
||||||
|
import pp.s1184725.boppi.symboltable.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class performs type checking and variable assignment on a bare parse
|
* This class performs type checking and variable assignment on a bare parse
|
||||||
|
@ -394,7 +395,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type visitTypeFunction(TypeFunctionContext ctx) {
|
public Type visitTypeFunction(TypeFunctionContext ctx) {
|
||||||
return new FunctionType(visit(ctx.type(1)), visit(ctx.type(0)));
|
return new FunctionType(visit(ctx.type(0)), visit(ctx.type(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,7 +13,7 @@ import pp.iloc.model.*;
|
||||||
import pp.s1184725.boppi.antlr.*;
|
import pp.s1184725.boppi.antlr.*;
|
||||||
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
||||||
import pp.s1184725.boppi.type.*;
|
import pp.s1184725.boppi.type.*;
|
||||||
import pp.s1184725.boppi.util.RegisterPool;
|
import pp.s1184725.boppi.symboltable.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The generator stage of the Boppi toolchain.
|
* The generator stage of the Boppi toolchain.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package pp.s1184725.boppi.util;
|
package pp.s1184725.boppi;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.*;
|
import java.util.function.*;
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This package contains the Boppi language grammar and, after ANTLR
|
||||||
|
* generation, the lexer, parser and visitor classes.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.antlr;
|
|
@ -1,6 +1,6 @@
|
||||||
package pp.s1184725.boppi.exception;
|
package pp.s1184725.boppi.exception;
|
||||||
|
|
||||||
import pp.s1184725.boppi.CachingSymbolTable;
|
import pp.s1184725.boppi.symboltable.CachingSymbolTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exceptions that may be thrown by the {@link CachingSymbolTable}.
|
* Exceptions that may be thrown by the {@link CachingSymbolTable}.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This package contains custom exceptions for
|
||||||
|
* {@link pp.s1184725.boppi.CachingSymbolTable}.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.exception;
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This package contains the main Boppi classes: a checker, generator,
|
||||||
|
* toolchain and supporting classes.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi;
|
|
@ -1,8 +1,9 @@
|
||||||
package pp.s1184725.boppi;
|
package pp.s1184725.boppi.symboltable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import pp.s1184725.boppi.Messages;
|
||||||
import pp.s1184725.boppi.exception.*;
|
import pp.s1184725.boppi.exception.*;
|
||||||
import pp.s1184725.boppi.type.*;
|
import pp.s1184725.boppi.type.*;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package pp.s1184725.boppi;
|
package pp.s1184725.boppi.symboltable;
|
||||||
|
|
||||||
import pp.s1184725.boppi.exception.*;
|
import pp.s1184725.boppi.exception.*;
|
||||||
import pp.s1184725.boppi.type.*;
|
import pp.s1184725.boppi.type.*;
|
|
@ -1,4 +1,4 @@
|
||||||
package pp.s1184725.boppi;
|
package pp.s1184725.boppi.symboltable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
|
@ -1,4 +1,4 @@
|
||||||
package pp.s1184725.boppi;
|
package pp.s1184725.boppi.symboltable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class tracks a variable's properties. It is agnostic of the type system
|
* This class tracks a variable's properties. It is agnostic of the type system
|
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* This package contains a symbol table implementation.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.symboltable;
|
|
@ -8,7 +8,7 @@ import java.util.logging.Level;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import pp.s1184725.boppi.util.RegisterPool;
|
import pp.s1184725.boppi.RegisterPool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for the basic expression language.
|
* Test cases for the basic expression language.
|
||||||
|
@ -63,6 +63,7 @@ public class ExpressionTest {
|
||||||
public void wrongExpressionChecking() {
|
public void wrongExpressionChecking() {
|
||||||
BoppiTests.checkString("+true");
|
BoppiTests.checkString("+true");
|
||||||
assertThat(BoppiTests.log, hasSize(1));
|
assertThat(BoppiTests.log, hasSize(1));
|
||||||
|
BoppiTests.printOutput();
|
||||||
|
|
||||||
BoppiTests.checkString("5 || true");
|
BoppiTests.checkString("5 || true");
|
||||||
assertThat(BoppiTests.log, hasSize(1));
|
assertThat(BoppiTests.log, hasSize(1));
|
||||||
|
@ -85,6 +86,7 @@ public class ExpressionTest {
|
||||||
BoppiTests.compileAndRunString("print(5*3)");
|
BoppiTests.compileAndRunString("print(5*3)");
|
||||||
assertThat(BoppiTests.log, is(empty()));
|
assertThat(BoppiTests.log, is(empty()));
|
||||||
assertThat(BoppiTests.out, is(arrayContaining("15")));
|
assertThat(BoppiTests.out, is(arrayContaining("15")));
|
||||||
|
BoppiTests.printOutput();
|
||||||
|
|
||||||
BoppiTests.compileAndRunString("print('T', 'e', 's', 't', '!')");
|
BoppiTests.compileAndRunString("print('T', 'e', 's', 't', '!')");
|
||||||
assertThat(BoppiTests.log, is(empty()));
|
assertThat(BoppiTests.log, is(empty()));
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/**
|
||||||
|
* This package contains JUnit tests for Boppi features and memlib.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.test;
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This package contains the types in Boppi. Type unification and checking is
|
||||||
|
* currently performed in {@link pp.s1184725.boppi.BoppiChecker}.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.type;
|
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This package provides a command-line interface for compiling Boppi code
|
||||||
|
* and a rudimentary REPL.
|
||||||
|
*/
|
||||||
|
package pp.s1184725.boppi.util;
|
Loading…
Reference in New Issue