public Type getType(Environment<Type> env) throws TypeIllegalException,
			TypeEnvironmentException {
		if (jjtGetNumChildren() == 1)
			return getChild(0).getType(env); // Channel

		Type type;

		Token token = jjtGetFirstToken();
		switch (token.kind) {
		case PseuCoParserConstants.BOOL:
			type = new Type(Type.BOOL);
			break;

		case PseuCoParserConstants.INT:
			type = new Type(Type.INT);
			break;

		case PseuCoParserConstants.STRING:
			type = new Type(Type.STRING);
			break;

		case PseuCoParserConstants.LOCK:
			type = new Type(Type.LOCK);
			break;

		case PseuCoParserConstants.AGENT:
			type = new Type(Type.AGENT);
			break;

		case PseuCoParserConstants.IDENTIFIER:
			type = env.getGlobalValue(token.image, this.firstToken);
			break;

		default:
			throw new IllegalStateException("Something is wrong here!");
		}

		return new TypeType(type);
	}