diff --git a/expressions.txt b/expressions.txt
index 74f9b719cba435602fbafc8e493b634bc5f8ac4f..a5fb886ae1c6e4e5a0f738283f642e8af25beded 100644
--- a/expressions.txt
+++ b/expressions.txt
@@ -1,2 +1,2 @@
-1+(x^2)-(3*x)
+1+(x^2.22)-(3*x)
 2*x+0.5*(x^2+4)-1
\ No newline at end of file
diff --git a/src/main/Application.java b/src/main/Application.java
index f65d712b5d0113f5e12565164d6cb5b0604925c1..466f25baab48d96e8921b81867c1023640695c29 100644
--- a/src/main/Application.java
+++ b/src/main/Application.java
@@ -32,17 +32,25 @@ public class Application {
         }
 
         //Iterate through every String
-        for (String expression: expressions) {
-            System.out.println("Expression: " + expression);
+        for (String expressionString: expressions) {
+            System.out.println("Expression: " + expressionString);
             //Usage of the lexer, parser & evaluator
             try {
                 //Create a list of tokens with the lexer
-                List<Lexer.Token> tokens = Lexer.lex(expression);
+                List<Lexer.Token> tokens = Lexer.lex(expressionString);
                 System.out.println("Lexer created tokens:");
                 //prints out each token to the console
                 for(Lexer.Token token: tokens) {
                     System.out.println(token.toString());
                 }
+                //Parse all tokens with the parser and saves the result into the variable 'ast'
+                Parser parser = new Parser();
+                Parser.Expression ast = parser.parse(tokens);
+                //Prints the ast out with an ASTPrinter
+                //the result can later be used to show the ast in a function plotter
+                ASTPrinter printer = new ASTPrinter();
+                System.out.println("Printing: '" + printer.visit(ast) + "'");
+                System.out.println();
             }
             catch (Exception e) {
                 e.printStackTrace();
@@ -51,22 +59,10 @@ public class Application {
         }
 
         /*
-        //Iterates through every String and parses them into multiple tokens
-        for (String value: expressions) {
-            Parser parser = new Parser();
-            try {
-                Parser.Expression exp = parser.parse(tokens);
-                ASTPrinter printer = new ASTPrinter();
                 Evaluator evaluator = new Evaluator();
-                System.out.println("Printing: '" + printer.visit(exp) + "'");
                 String s = printer.visit(exp);
                 System.out.println("Evaluating: '" + evaluator.visit(exp) + "'");
                 SwingFunctionPlotter.plotFunction(s);
-            }
-            catch (ParserException e) {
-                System.out.println(e.getMessage());
-            }
-            System.out.println();
         }*/
     }
 }
diff --git a/src/main/Lexer.java b/src/main/Lexer.java
index d84a782eea24adfdc713830ed8c2208b991caa4a..8b8b4ba2e2f51d1b53d776abf917c7d3550d2de9 100644
--- a/src/main/Lexer.java
+++ b/src/main/Lexer.java
@@ -93,7 +93,9 @@ public class Lexer {
                 index++;
             }
         }
-
+        if(result.isEmpty()) {
+            throw new LexerException("SyntaxError: lexer couldn't create any tokens out of the input");
+        }
         return result;
     }
 }
diff --git a/src/main/Parser.java b/src/main/Parser.java
index ca46fc9dd4cded7646645b36a3b038cddc5b9468..ac39ec2d8d1b674e484711d6437bee031485e71f 100644
--- a/src/main/Parser.java
+++ b/src/main/Parser.java
@@ -7,10 +7,17 @@ import java.util.List;
 
 public class Parser {
 
+    //This abstract class is only used for heredity
+    //It represents an expression in the form of an Abstract Syntax Tree(AST)
+    //A method 'accept' is implemented, it is used for allowing other classes to interact with it
+    //through the visiting pattern
     public abstract class Expression {
         public abstract <T> T accept(Visitor<T> visitor);
     }
 
+    //This class represents a binary operation
+    //it contains a left expression, an operator, and a right expression
+    //if this operation is capsuled by brackets, the value of 'capsuled' will be true, else it will be false
     public class BinaryOperation extends Expression {
         Expression leftExpression;
         String operator;
@@ -31,6 +38,8 @@ public class Parser {
         }
     }
 
+    //This class represents a variable, with it holds a String 'variableName' that contains a character
+    //of the alphabet
     public class Variable extends Expression {
         String variableName;
         public Variable(String i, Boolean capsuled) {
@@ -41,10 +50,13 @@ public class Parser {
         }
     }
 
+    //This abstract class is only used for heredity
+    //A value can either be a number or a decimal
     private abstract class Value extends Expression {
 
     }
 
+    //This class represents a number, it contains a String 'digits' that holds it value
     public class Number extends Value {
         public String digits;
         public Number(String i) {
@@ -55,6 +67,7 @@ public class Parser {
         }
     }
 
+    //This class represents a decimal, it contains two numbers: the one before- and the one after the dot
     public class Decimal extends Value {
         public Number beforeDot;
         public Number afterDot;
@@ -69,7 +82,7 @@ public class Parser {
     }
 
     //starting method of the parser
-    //parses a list of tokens
+    //parses a list of tokens and returns the AST (Abstract Syntax Tree)
     public Expression parse(List<Lexer.Token> list) throws ParserException {
         if(list.isEmpty()) {
             throw new ParserException("empty token list");
@@ -103,6 +116,46 @@ public class Parser {
         return ast;
     }
 
+
+
+
+
+
+    private BinaryOperation parseBinaryOperation(List<Lexer.Token> ts) throws ParserException {
+        if(ts.isEmpty()) {
+            throw new ParserException("SyntaxError: empty token list");
+        }
+        if(ts.size()==1) {
+            return null;
+        }
+        int index = 0;
+        int tokensInBracket = parseBrackets(ts);
+        boolean capsuled;
+        if(tokensInBracket+1==ts.size()) {
+            ts.remove(tokensInBracket);
+            ts.remove(0);
+            capsuled = true;
+            index = 1;
+        }
+        else if (tokensInBracket==-1) {
+            capsuled = false;
+            parseOperator(ts.get(1).getData());
+            index = 1;
+        }
+        else {
+            capsuled = false;
+            index = tokensInBracket+1;
+        }
+        List<Lexer.Token> leftList = new LinkedList<>();
+        for(int iterator = 0; iterator<index; iterator++) {
+            leftList.add(ts.remove(0));
+        }
+        Expression leftExpression = parseExpression(leftList);
+        String operator = ts.remove(0).getData();
+        Expression rightExpression = parseExpression(ts);
+        return new BinaryOperation(leftExpression, operator, rightExpression, capsuled);
+    }
+
     //checks if a String only contains an allowed operator with parseCharacter(...)
     private boolean parseOperator(String operator) throws ParserException {
         if(operator.length()>1) {
@@ -143,62 +196,42 @@ public class Parser {
         return -1;
     }
 
-    private BinaryOperation parseBinaryOperation(List<Lexer.Token> ts) throws ParserException {
-        if(ts.isEmpty()) {
-            throw new ParserException("SyntaxError: empty token list");
-        }
-        if(ts.size()==1) {
-            return null;
-        }
-        int index = 0;
-        int tokensInBracket = parseBrackets(ts);
-        boolean capsuled;
-        if(tokensInBracket+1==ts.size()) {
-            ts.remove(tokensInBracket);
-            ts.remove(0);
-            capsuled = true;
-            index = 1;
-        }
-        else if (tokensInBracket==-1) {
-            capsuled = false;
-            parseOperator(ts.get(1).getData());
-            index = 1;
-        }
-        else {
-            capsuled = false;
-            index = tokensInBracket+1;
-        }
-        List<Lexer.Token> leftList = new LinkedList<>();
-        for(int iterator = 0; iterator<index; iterator++) {
-            leftList.add(ts.remove(0));
-        }
-        Expression leftExpression = parseExpression(leftList);
-        String operator = ts.remove(0).getData();
-        Expression rightExpression = parseExpression(ts);
-        return new BinaryOperation(leftExpression, operator, rightExpression, capsuled);
-    }
 
+
+
+    //called by parseExpression
+    //Checks if a token is a variable:
+    //Yes: returns a new Variable that gets created with the received token
+    //No: returns null
     private Variable parseVariable(List<Lexer.Token> ts) throws ParserException {
         if (ts.isEmpty()) {
             throw new ParserException("SyntaxError: empty token list");
         }
+        //If the TokenType is != VARIABLE the token is not a variable and null gets returned
         if (ts.get(0).getType() != Lexer.TokenType.VARIABLE) {
             return null;
         }
+        if (ts.get(0).getData().length()>1) {
+            throw new ParserException("Invalid size for a variable!");
+        }
 
         String data = ts.remove(0).getData();
+        //If the token is empty, throw a ParserException
         if (data.isEmpty()) {
             throw new ParserException("SyntaxError: empty token");
         }
-
+        //Checks if the variable is a character of the alphabet, if not the token is not valid
         if(!parseCharacter(data,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")) {
             throw new ParserException("Invalid variable character: " + data);
         }
         return new Variable(data, false);
     }
 
-    //called by method parseException(...)
-    //parses a token/list of tokens into a value
+
+    //called by method parseException
+    //Checks if a token is a value:
+    //Yes: returns a new Number or Decimal that gets created with the received token
+    //No: returns null
     private Value parseValue(List<Lexer.Token> ts) throws ParserException {
         if (ts.isEmpty()) {
             throw new ParserException("SyntaxError: empty token list");
@@ -217,12 +250,13 @@ public class Parser {
         return parseNumber(data, false);
     }
 
-    //called by method parseValue(...)
-    //parses a decimal of a list of tokens & a string
+    //called by method parseValue
+    //parses a decimal of a string
     private Decimal parseDecimal(String data) throws ParserException {
         if(data.isEmpty()) {
             throw new ParserException("SyntaxError: empty data");
         }
+        //Separates the String into the number before- and after the dot
         int dot = data.indexOf('.');
         String number1 = data.substring(0,dot);
         String number2 = data.substring(dot+1);
@@ -231,29 +265,37 @@ public class Parser {
         return new Decimal(beforeDot, afterDot);
     }
 
-    //called by method parseValue(...)
+    //called by method parseValue or parseDecimal
     //parses a String into a number
+    //the parameter afterDot will be set on 'true' if the number is used after a dot of a decimal
     private Number parseNumber(String data, boolean afterDot) throws ParserException{
         if (data.isEmpty()) {
             throw new ParserException("RuntimeException: empty token");
         }
-
+        //if the number only contains the digit 0, it can be returned already
         if (data.startsWith("0") && data.length() == 1) {
             return new Number(data);
         }
-        if(afterDot) {
+        //Checks if all digits of the number are permitted
+        //If afterDot is false, the first digit is not allowed to be 0
+        if(!afterDot) {
             parseDigitWithoutZero(data.substring(0,1));
             parseDigit(data.substring(1));
         }
+        //Checks if all digits of the number are permitted
         else {
             parseDigit(data);
         }
         return new Number(data);
     }
 
-    //called by method parseNumber(...)
-    //checks if a String only contains numbers(including zero) with parseCharacter(...)
+    //called by method parseNumber
+    //checks if a String only contains numbers(including zero) with parseCharacter
+    //if not, a ParserException is thrown
     private void parseDigit(String data) throws ParserException {
+        if(data.isEmpty()) {
+            throw new ParserException("RuntimeError: empty String instead of a digit(0-9)");
+        }
         for(int index=0; index<data.length(); index++) {
             String character = Character.toString(data.charAt(index));
             if(!parseCharacter(character, "0123456789")) {
@@ -262,9 +304,13 @@ public class Parser {
         }
     }
 
-    //called by method parseNumber(...)
-    //checks if a String only contains numbers(excluding zero) with parseCharacter(...)
+    //called by method parseNumber
+    //checks if a String only contains numbers(excluding zero) with parseCharacter
+    //if not, a ParserException is thrown
     private void parseDigitWithoutZero(String data) throws ParserException {
+        if(data.isEmpty()) {
+            throw new ParserException("RuntimeError: empty String instead of a digit(1-9)");
+        }
         for(int index=0; index<data.length(); index++) {
             String character = Character.toString(data.charAt(index));
             if(!parseCharacter(character, "123456789")) {
@@ -273,8 +319,8 @@ public class Parser {
         }
     }
 
-    //called by methods parseOperator(...), parseDigit(...), parseDigitWithoutZero(...)
-    //checks if a certain string can be found in a string of allowed character
+    //called by multiple methods e.g. parserOperator, parseDigit
+    //checks if a certain string can be found in a String of allowed characters and returns the result
     private boolean parseCharacter(String data, String allowedCharacters) throws ParserException {
         if(data.isEmpty()) {
             throw new ParserException("RuntimeError: empty String");
diff --git a/src/test/ParserTest.java b/src/test/ParserTest.java
index 0be7f64628e6179efc67d8d19221043802094627..090bb6006216f90487d77072922171a0c0a82df8 100644
--- a/src/test/ParserTest.java
+++ b/src/test/ParserTest.java
@@ -1,4 +1,65 @@
 package test;
 
+import main.Lexer;
+import main.Parser;
+import org.junit.Test;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class ParserTest {
+
+    @Test
+    void testParseVariable() {
+        List<Lexer.Token> tokens = new LinkedList<>();
+        tokens.add(new Lexer.Token(Lexer.TokenType.VARIABLE,"x"));
+        var parser = new Parser();
+        try {
+            var ast = parser.parse(tokens);
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    void testWrongVariableInput() {
+        List<Lexer.Token> tokens = new LinkedList<>();
+        tokens.add(new Lexer.Token(Lexer.TokenType.VARIABLE,"xy"));
+        var parser = new Parser();
+        try {
+            var ast = parser.parse(tokens);
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    void testParseNumber() {
+        List<Lexer.Token> tokens = new LinkedList<>();
+        tokens.add(new Lexer.Token(Lexer.TokenType.NUMBER,"23"));
+        var parser = new Parser();
+        try {
+            var ast = parser.parse(tokens);
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    void testWrongNumberInput() {
+        List<Lexer.Token> tokens = new LinkedList<>();
+        tokens.add(new Lexer.Token(Lexer.TokenType.NUMBER,"02.4"));
+        var parser = new Parser();
+        try {
+            var ast = parser.parse(tokens);
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
 }