This commit is contained in:
Moritz Dieing 2021-02-21 11:49:54 +01:00
commit 0c1cdfa118
4 changed files with 25 additions and 2 deletions

View File

@ -10,7 +10,8 @@ import java.util.*;
/** /**
* Instances of this implementation of TypeInfererInterface are used to execute the sub-inference starting in let steps. * Instances of this implementation of TypeInfererInterface are used to execute the sub-inference starting in let steps.
* They provide an extended constructor to make sure this sub-inference is consistent with the "outer" inference. * They provide an extended constructor (compared to the standard type inferer) to make sure this sub-inference
* is consistent with the "outer" inference.
*/ */
public class TypeInfererLet implements TypeInfererInterface { public class TypeInfererLet implements TypeInfererInterface {
@ -20,6 +21,8 @@ public class TypeInfererLet implements TypeInfererInterface {
/** /**
* Initializes a new TypeInfererLet for the given type assumptions, lambda term and type variable factory. * Initializes a new TypeInfererLet for the given type assumptions, lambda term and type variable factory.
* The inference step structure, unification steps, the most general unifier and the
* final type are generated and calculated here.
* *
* @param lambdaTerm the lambda term to generate the tree for * @param lambdaTerm the lambda term to generate the tree for
* @param typeAssumptions the type assumptions to consider when generating the tree * @param typeAssumptions the type assumptions to consider when generating the tree

View File

@ -0,0 +1,10 @@
/**
* The presenter connects the model and the view.
* It passes the data from the model to the view and the user input from the view to the model.
*/
@NonNullFields
@NonNullApi
package edu.kit.typicalc.presenter;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

View File

@ -0,0 +1,9 @@
/**
* The util package contains classes used in all components of the application.
*/
@NonNullFields
@NonNullApi
package edu.kit.typicalc.util;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

View File

@ -201,7 +201,8 @@ class TypeAssumptionParserTest {
tests.put("(x", ParseError.TOO_FEW_TOKENS); tests.put("(x", ParseError.TOO_FEW_TOKENS);
tests.put("x 11", ParseError.UNEXPECTED_TOKEN.withToken(new Token(Token.TokenType.NUMBER, "11", 2))); tests.put("x 11", ParseError.UNEXPECTED_TOKEN.withToken(new Token(Token.TokenType.NUMBER, "11", 2)));
tests.put("x )", ParseError.UNEXPECTED_TOKEN.withToken(new Token(Token.TokenType.RIGHT_PARENTHESIS, ")", 2))); tests.put("x )", ParseError.UNEXPECTED_TOKEN.withToken(new Token(Token.TokenType.RIGHT_PARENTHESIS, ")", 2)));
tests.put("x -> (x) )", ParseError.UNEXPECTED_TOKEN.withToken(new Token(Token.TokenType.RIGHT_PARENTHESIS, ")", 9))); tests.put("x -> (x) )", ParseError.UNEXPECTED_TOKEN
.withToken(new Token(Token.TokenType.RIGHT_PARENTHESIS, ")", 9)));
for (Map.Entry<String, ParseError> entry : tests.entrySet()) { for (Map.Entry<String, ParseError> entry : tests.entrySet()) {
TypeAssumptionParser parser = new TypeAssumptionParser(); TypeAssumptionParser parser = new TypeAssumptionParser();
Result<Map<VarTerm, TypeAbstraction>, ParseError> type = parser.parse(Map.of("type1", entry.getKey())); Result<Map<VarTerm, TypeAbstraction>, ParseError> type = parser.parse(Map.of("type1", entry.getKey()));