public void StringArgumentToNot()
        {
            var stringlit = new StringLiteral("\"foobar\"", 0);
            var not = new UnaryNot(stringlit, 0);
            var assert = new ExpressionStatement("assert", not, 0);
            statementlist.Add(assert);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
        public void UnaryNot()
        {
            var integer = new IntegerLiteral("42", 0);
            var and = new LogicalOp("=", integer, integer, 0);
            var not = new UnaryNot(and, 0);
            var assert = new ExpressionStatement("assert", and, 0);
            statementlist.Add(assert);
            var parsetree = new Program(statementlist);

            Assert.DoesNotThrow(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
        public void IntegerArgumentToNot()
        {
            var integer = new IntegerLiteral("5", 0);
            var not = new UnaryNot(integer, 0);
            var assert = new ExpressionStatement("assert", not, 0);
            statementlist.Add(assert);
            var parsetree = new Program(statementlist);

            Assert.Throws<SemanticError>(() => symbolTableBuilder.BuildSymbolTableAndTypeCheck(parsetree));
        }
 public void visit(UnaryNot node)
 {
     if (operandtypes.Pop() == "bool")
         operandtypes.Push("bool");
     else
         throw new SemanticError("Invalid argument type for unary not operator \"!\" on row " +
             node.Row + ".");
 }