refactor packages, add package-info
This commit is contained in:
parent
846df01b11
commit
ec8617354e
|
@ -7,10 +7,11 @@ import org.antlr.v4.runtime.tree.ParseTreeProperty;
|
|||
|
||||
import pp.iloc.model.Reg;
|
||||
import pp.s1184725.boppi.type.*;
|
||||
import pp.s1184725.boppi.symboltable.*;
|
||||
|
||||
/**
|
||||
* This class holds properties of all AST nodes during compilation.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class Annotations {
|
||||
|
|
|
@ -10,11 +10,12 @@ import pp.s1184725.boppi.antlr.*;
|
|||
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
||||
import pp.s1184725.boppi.exception.*;
|
||||
import pp.s1184725.boppi.type.*;
|
||||
import pp.s1184725.boppi.symboltable.*;
|
||||
|
||||
/**
|
||||
* This class performs type checking and variable assignment on a bare parse
|
||||
* tree.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
||||
|
@ -25,7 +26,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
/**
|
||||
* Checks and annotates a program. Problems are reported to the given
|
||||
* logger.
|
||||
*
|
||||
*
|
||||
* @param ast
|
||||
* the program's AST
|
||||
* @param logger
|
||||
|
@ -47,7 +48,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
|
||||
/**
|
||||
* Checks whether two types are compatible and log an error if they do not.
|
||||
*
|
||||
*
|
||||
* @param type1
|
||||
* the left hand or actual type
|
||||
* @param type2
|
||||
|
@ -62,7 +63,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
|
||||
/**
|
||||
* Returns an error message for a given parse tree node.
|
||||
*
|
||||
*
|
||||
* @param ctx
|
||||
* the parse tree node at which the error occurred
|
||||
* @param message
|
||||
|
@ -81,7 +82,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
* within a set root (may be {@code null}). Effectively traverses between
|
||||
* {@code current} and {@code root} in the parent hierarchy looking for a
|
||||
* {@code rule} class.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* the rule class
|
||||
* @param ctx
|
||||
|
@ -105,7 +106,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
/**
|
||||
* Visits the parse tree, then records the returned type in the type
|
||||
* annotations and returns it too.
|
||||
*
|
||||
*
|
||||
* @param tree
|
||||
* the tree to visit
|
||||
* @return the evaluated type of the tree
|
||||
|
@ -394,7 +395,7 @@ public class BoppiChecker extends BoppiBaseVisitor<Type> {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -13,11 +13,11 @@ import pp.iloc.model.*;
|
|||
import pp.s1184725.boppi.antlr.*;
|
||||
import pp.s1184725.boppi.antlr.BoppiParser.*;
|
||||
import pp.s1184725.boppi.type.*;
|
||||
import pp.s1184725.boppi.util.RegisterPool;
|
||||
import pp.s1184725.boppi.symboltable.*;
|
||||
|
||||
/**
|
||||
* The generator stage of the Boppi toolchain.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
||||
|
@ -83,7 +83,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
/**
|
||||
* Creates a new generator with the given variable annotations and attaches
|
||||
* the given logger.
|
||||
*
|
||||
*
|
||||
* @param ast
|
||||
* the program's AST
|
||||
* @param annotations
|
||||
|
@ -142,7 +142,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
|
||||
/**
|
||||
* Increments the chain of ARs.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param ar
|
||||
|
@ -168,7 +168,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
|
||||
/**
|
||||
* Decrements the chain of ARs.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param ar
|
||||
|
@ -195,7 +195,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
/**
|
||||
* Allocates a chunk of memory and returns a pointer to the memory in the
|
||||
* given register.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param size
|
||||
|
@ -213,7 +213,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
/**
|
||||
* Allocates a chunk of memory and returns a pointer to the memory in the
|
||||
* given register.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param size
|
||||
|
@ -229,7 +229,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
|
||||
/**
|
||||
* Frees a chunk of memory pointed at by {@code ptr}.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param ptr
|
||||
|
@ -244,7 +244,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
|
||||
/**
|
||||
* Increments the reference count of a memory chunk.
|
||||
*
|
||||
*
|
||||
* @param temp
|
||||
* temporary register to use
|
||||
* @param ptr
|
||||
|
@ -259,7 +259,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
|
||||
/**
|
||||
* Returns an error message for a given parse tree node.
|
||||
*
|
||||
*
|
||||
* @param ctx
|
||||
* the parse tree node at which the error occurred
|
||||
* @param message
|
||||
|
@ -276,7 +276,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
/**
|
||||
* Constructs a new unique label with the given prefix to make it
|
||||
* recognisable in ILOC.
|
||||
*
|
||||
*
|
||||
* @param prefix
|
||||
* a short prefix for the label
|
||||
* @return the label
|
||||
|
@ -289,7 +289,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
* Increments the reference count to a type if it is a reference type. For
|
||||
* function types this includes all access links. Assumes registers are
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type of this reference
|
||||
* @param addr
|
||||
|
@ -316,7 +316,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
* Decrements the reference count to a type if it is a reference type. For
|
||||
* function types this includes all access links. Assumes registers are
|
||||
* reserved.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type of this reference
|
||||
* @param addr
|
||||
|
@ -350,7 +350,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
/**
|
||||
* Decrements all reference-type variables of a function. Must be called at
|
||||
* the end of a function declaration. Assumes registers are reserved.
|
||||
*
|
||||
*
|
||||
* @param scope
|
||||
* the function scope with all relevant variables
|
||||
*/
|
||||
|
@ -641,7 +641,7 @@ public class BoppiGenerator extends BoppiBaseVisitor<Reg> {
|
|||
* Loads the value on the address pointed to by the variable context.
|
||||
* Because the array length is not stored by itself, it will be calculated
|
||||
* here from the size property.
|
||||
*
|
||||
*
|
||||
* @see BoppiBaseVisitor#visitGetVariable(GetVariableContext)
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package pp.s1184725.boppi.util;
|
||||
package pp.s1184725.boppi;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
|
@ -19,13 +19,13 @@ public class RegisterPool {
|
|||
* Register that must have a value of 0.
|
||||
*/
|
||||
public static final Reg ZERO = new Reg("r_nul");
|
||||
|
||||
|
||||
private Logger logger;
|
||||
private List<Reg> regFree, regInUse;
|
||||
|
||||
/**
|
||||
* Creates a new register pool
|
||||
*
|
||||
*
|
||||
* @param logger
|
||||
* the logger to use
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Blocks two registers while running some code.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* the return type of the code
|
||||
* @param r1
|
||||
|
@ -65,7 +65,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Blocks a register while running some code.
|
||||
*
|
||||
*
|
||||
* @param r1
|
||||
* the register to reserve
|
||||
* @param code
|
||||
|
@ -79,7 +79,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Blocks a register while running some code.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* the return type of the code
|
||||
* @param r1
|
||||
|
@ -108,7 +108,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Returns the list of registers currently in use.
|
||||
*
|
||||
*
|
||||
* @return the list of registers in use
|
||||
*/
|
||||
public List<Reg> getInUse() {
|
||||
|
@ -136,7 +136,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Runs some code with two registers allocated.
|
||||
*
|
||||
*
|
||||
* @param code
|
||||
* the code to run
|
||||
* @return the second register used in the code
|
||||
|
@ -147,7 +147,7 @@ public class RegisterPool {
|
|||
|
||||
/**
|
||||
* Runs some code with a single register allocated.
|
||||
*
|
||||
*
|
||||
* @param code
|
||||
* the code to run
|
||||
* @return the register used in the code
|
|
@ -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;
|
||||
|
||||
import pp.s1184725.boppi.CachingSymbolTable;
|
||||
import pp.s1184725.boppi.symboltable.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.function.Supplier;
|
||||
|
||||
import pp.s1184725.boppi.Messages;
|
||||
import pp.s1184725.boppi.exception.*;
|
||||
import pp.s1184725.boppi.type.*;
|
||||
|
||||
|
@ -15,7 +16,7 @@ import pp.s1184725.boppi.type.*;
|
|||
*
|
||||
* @param <T>
|
||||
* the typing class
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class CachingSymbolTable<T extends Type> {
|
||||
|
@ -36,9 +37,9 @@ public class CachingSymbolTable<T extends Type> {
|
|||
* Closes a lexical scope for a function declaration, removing all
|
||||
* declarations within this scope, restoring the local offset and decreasing
|
||||
* the lookup depth.
|
||||
*
|
||||
*
|
||||
* @return function scope details
|
||||
*
|
||||
*
|
||||
* @throws NoProgramException
|
||||
* if no scope is open
|
||||
*/
|
||||
|
@ -51,7 +52,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
* Closes a lexical scope, removing all declarations within this scope. Runs
|
||||
* in {@code O(k log k log n)} time, with {@code k} the number of
|
||||
* identifiers going out of scope, when the stream is parallelized.
|
||||
*
|
||||
*
|
||||
* @throws NoProgramException
|
||||
* if no scope is open
|
||||
*/
|
||||
|
@ -69,7 +70,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
|
||||
/**
|
||||
* Returns the type of an identifier, if any.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the name of the identifier
|
||||
* @return the type of the identifier
|
||||
|
@ -87,7 +88,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
|
||||
/**
|
||||
* Returns the current function scope, if any.
|
||||
*
|
||||
*
|
||||
* @return the current function scope
|
||||
* @throws NoProgramException
|
||||
* if no scope is open
|
||||
|
@ -101,7 +102,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
|
||||
/**
|
||||
* Returns whether the given identifier is declared.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the name of the identifier
|
||||
* @return true if the identifier has a declared type
|
||||
|
@ -136,7 +137,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
* and returns the newly made variable instance that belongs to this
|
||||
* identifier. Throws an exception if the identifier is declared in this
|
||||
* scope already.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the name of the identifier
|
||||
* @param type
|
||||
|
@ -166,7 +167,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
* helper method to make sure calls to {@link #openFunctionScope()} and
|
||||
* {@link #closeFunctionScope()} are balanced and returns the function scope
|
||||
* details. {@code code} must take no arguments and must not return a value.
|
||||
*
|
||||
*
|
||||
* @param code
|
||||
* the code to execute within the scope
|
||||
* @return the function scope details
|
||||
|
@ -187,7 +188,7 @@ public class CachingSymbolTable<T extends Type> {
|
|||
* helper method to make sure calls to {@link #openScope()} and
|
||||
* {@link #closeScope()} are balanced. {@code code} must take no arguments
|
||||
* and must return a value.
|
||||
*
|
||||
*
|
||||
* @param <U>
|
||||
* the type of the code's return value
|
||||
* @param code
|
|
@ -1,4 +1,4 @@
|
|||
package pp.s1184725.boppi;
|
||||
package pp.s1184725.boppi.symboltable;
|
||||
|
||||
import pp.s1184725.boppi.exception.*;
|
||||
import pp.s1184725.boppi.type.*;
|
||||
|
@ -9,7 +9,7 @@ import pp.s1184725.boppi.type.*;
|
|||
*
|
||||
* @param <T>
|
||||
* the typing class
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class DebugCachingSymbolTable<T extends Type> extends CachingSymbolTable<T> {
|
|
@ -1,4 +1,4 @@
|
|||
package pp.s1184725.boppi;
|
||||
package pp.s1184725.boppi.symboltable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -7,9 +7,9 @@ import pp.s1184725.boppi.type.Type;
|
|||
|
||||
/**
|
||||
* Keeps track of local data for functions.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* the type system to use
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@ public class FunctionScope<T extends Type> {
|
|||
|
||||
/**
|
||||
* Creates a function scope with the given depth.
|
||||
*
|
||||
*
|
||||
* @param depth
|
||||
* the lexical depth of this function
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ public class FunctionScope<T extends Type> {
|
|||
|
||||
/**
|
||||
* Creates a new variable in this function scope and returns it.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type of variable to create
|
||||
* @return the variable created
|
||||
|
@ -44,7 +44,7 @@ public class FunctionScope<T extends Type> {
|
|||
|
||||
/**
|
||||
* Returns the current lexical scope/function depth.
|
||||
*
|
||||
*
|
||||
* @return the function depth
|
||||
*/
|
||||
public int getFunctionDepth() {
|
||||
|
@ -56,7 +56,7 @@ public class FunctionScope<T extends Type> {
|
|||
* in the current function scope. Note that this is the size calculated up
|
||||
* and including the last variable declaration, so make sure to call it
|
||||
* right before leaving a function scope.
|
||||
*
|
||||
*
|
||||
* @return the number of bytes required to store all variables local to a
|
||||
* function
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ public class FunctionScope<T extends Type> {
|
|||
|
||||
/**
|
||||
* Returns the variables local to this function scope.
|
||||
*
|
||||
*
|
||||
* @return a list of variables
|
||||
*/
|
||||
public List<Variable<T>> getVars() {
|
|
@ -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
|
||||
|
@ -6,7 +6,7 @@ package pp.s1184725.boppi;
|
|||
*
|
||||
* @param <T>
|
||||
* the typing class
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class Variable<T> {
|
||||
|
@ -18,7 +18,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Creates a variable with the given type instance and memory offset.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type of the variable
|
||||
* @param depth
|
||||
|
@ -43,7 +43,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Gets the lexical depth of this variable instance.
|
||||
*
|
||||
*
|
||||
* @return the depth
|
||||
*/
|
||||
public int getDepth() {
|
||||
|
@ -52,7 +52,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Gets the local data offset of this variable instance.
|
||||
*
|
||||
*
|
||||
* @return the offset
|
||||
*/
|
||||
public int getOffset() {
|
||||
|
@ -61,7 +61,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Gets the type of this variable instance.
|
||||
*
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public T getType() {
|
||||
|
@ -70,7 +70,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Returns whether this variable has been assigned.
|
||||
*
|
||||
*
|
||||
* @return whether this variable has been assigned
|
||||
*/
|
||||
public boolean isAssigned() {
|
||||
|
@ -79,7 +79,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Returns whether this variable is a constant.
|
||||
*
|
||||
*
|
||||
* @return whether this variable is a constant
|
||||
*/
|
||||
public boolean isConstant() {
|
||||
|
@ -88,7 +88,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Returns whether this variable has been assigned conditionally.
|
||||
*
|
||||
*
|
||||
* @return whether this variable has been assigned conditionally
|
||||
*/
|
||||
public boolean isPossiblyAssigned() {
|
||||
|
@ -104,7 +104,7 @@ public class Variable<T> {
|
|||
|
||||
/**
|
||||
* Sets the const-ness of this variable.
|
||||
*
|
||||
*
|
||||
* @param constant
|
||||
* whether this variable is a constant
|
||||
*/
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* This package contains a symbol table implementation.
|
||||
*/
|
||||
package pp.s1184725.boppi.symboltable;
|
|
@ -6,7 +6,7 @@ import org.junit.Test;
|
|||
|
||||
/**
|
||||
* Test cases for fixed-size arrays.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class ArrayTest {
|
||||
|
@ -127,17 +127,17 @@ public class ArrayTest {
|
|||
assertThat(BoppiTests.vm.getInterrupt(), is(0));
|
||||
assertThat(BoppiTests.log, is(empty()));
|
||||
assertThat(BoppiTests.out, is(arrayContaining("1337", "13", "2", "15")));
|
||||
|
||||
|
||||
BoppiTests.compileAndRunString("var int[][] m; m := [[1,3]]; m[0]; var int[] a; a := [8,9]; print(m[0][1])");
|
||||
assertThat(BoppiTests.vm.getInterrupt(), is(0));
|
||||
assertThat(BoppiTests.log, is(empty()));
|
||||
assertThat(BoppiTests.out, is(arrayContaining("3")));
|
||||
|
||||
|
||||
BoppiTests.compileAndRunString("print([1,2]==[1,2],[1,2]<>[1,2],[1]==[1,2],[0]<>[2])");
|
||||
assertThat(BoppiTests.vm.getInterrupt(), is(0));
|
||||
assertThat(BoppiTests.log, is(empty()));
|
||||
assertThat(BoppiTests.out, is(arrayContaining("true", "false", "false", "true")));
|
||||
|
||||
|
||||
BoppiTests.compileAndRunFile("programs/arrayFunctions.boppi", "Hello");
|
||||
assertThat(BoppiTests.vm.getInterrupt(), is(0));
|
||||
assertThat(BoppiTests.log, is(empty()));
|
||||
|
|
|
@ -8,11 +8,11 @@ import java.util.logging.Level;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import pp.s1184725.boppi.util.RegisterPool;
|
||||
import pp.s1184725.boppi.RegisterPool;
|
||||
|
||||
/**
|
||||
* Test cases for the basic expression language.
|
||||
*
|
||||
*
|
||||
* @author Frank Wibbelink
|
||||
*/
|
||||
public class ExpressionTest {
|
||||
|
@ -63,6 +63,7 @@ public class ExpressionTest {
|
|||
public void wrongExpressionChecking() {
|
||||
BoppiTests.checkString("+true");
|
||||
assertThat(BoppiTests.log, hasSize(1));
|
||||
BoppiTests.printOutput();
|
||||
|
||||
BoppiTests.checkString("5 || true");
|
||||
assertThat(BoppiTests.log, hasSize(1));
|
||||
|
@ -85,6 +86,7 @@ public class ExpressionTest {
|
|||
BoppiTests.compileAndRunString("print(5*3)");
|
||||
assertThat(BoppiTests.log, is(empty()));
|
||||
assertThat(BoppiTests.out, is(arrayContaining("15")));
|
||||
BoppiTests.printOutput();
|
||||
|
||||
BoppiTests.compileAndRunString("print('T', 'e', 's', 't', '!')");
|
||||
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