private Expr And()
        {
            var expr = Equality();

            while (Match(TokenType.And))
            {
                var op    = Previous();
                var right = Equality();
                expr = new LogicalExpr(expr, op, right);
            }

            return(expr);
        }
        private Expr Or()
        {
            var expr = And();

            while (Match(TokenType.Or))
            {
                var op    = Previous();
                var right = And();
                expr = new LogicalExpr(expr, op, right);
            }

            return(expr);
        }
        public object VisitLogicalExpr(LogicalExpr expr)
        {
            var left = Evaluate(expr.Left);

            if (expr.Operator.Type == TokenType.Or)
            {
                if (IsTruthy(left))
                {
                    return(left);
                }
            }
            else
            {
                if (!IsTruthy(left))
                {
                    return(left);
                }
            }

            return(Evaluate(expr.Right));
        }
 public void VisitLogicalExpr(LogicalExpr expr)
 {
     Resolve(expr.Left);
     Resolve(expr.Right);
 }
 public string VisitLogicalExpr(LogicalExpr expr)
 {
     throw new System.NotImplementedException();
 }