Wash carrot tops thoroughly and pat dry. Remove thick stems and keep the tender leaves and thin stems.
Toast walnuts or pecans in a dry skillet over medium heat for 2–3 minutes, stirring frequently until fragrant.
Add carrot tops, toasted nuts, basil, and garlic to a food processor. Pulse for 10–15 seconds until chopped.
Add Parmesan cheese and lemon juice. Pulse a few times to combine.
With the processor running, slowly drizzle in olive oil until the pesto becomes creamy and smooth.
If the pesto is too thick, add water one tablespoon at a time while pulsing.
Add salt and pepper and adjust lemon juice to taste. Transfer pesto to a jar and cover the surface with a thin layer of olive oil before refrigerating.