Toy Expression Interpreter
Am I using the "right" type for the Add subnodes (i.e. Rc)?


No. You probably don't want to do that. Just use AST. Good Rust code rarely actually needs Rc. Instead of using Rc&lt;&gt; in the definition of AST, use Box.

#[derive(Debug)]
pub enum AST&lt;T&gt; {
    ConstInt(isize, Rc&lt;T&gt;),
    Add(Box&lt;AST&lt;T&gt;&gt;, Box&lt;AST&lt;T&gt;&gt;, Rc&lt;T&gt;),
}


Now Rc does give you the ability to reuse branches of the AST. For example, you use x twice. However, I've not seen a real case of ASTs where that needs to happen. As it stands you are paying the costs of RC (both in programmer effort, execution time, and memory overahead) for no good reason.

You should also get rid of the Rc&lt;&gt; for the T. Just store a T. In cases where you need to be able to copy the T for some reason (which is probably never), take a &lt;T: Clone&gt; so you can call the clone method. The client code can then put in Rc&lt;&gt; in place if it wants, or if the data is trivial just allow it to be copied. 

I would also question the usefulness of a generic type here at all. Are you really going to annotate the same AST with different additional data in different places? I rather doubt it.


  Is it possible to create eval as an AST method instead of a function? I kept fighting the borrow checking if x in eval was self : &amp;AST (within the impl block, of course)


You'll find that if you don't try to pass ASTs in Rc&lt;&gt; that this will work much better. The problem is that you can't take self to be an Rc&lt;&gt;, so you don't get access to the reference counter itself which makes it difficult to do anything useful.

Even if you use RC, you can define a static method in the impl (just don't have a self parameter. Then you can use syntax like AST::eval(ast).

pub fn eval&lt;T&gt;(x: &amp;RAST&lt;T&gt;) -&gt; RAST&lt;T&gt; {


This function is pretty strange. Why does an evaluation function return an AST. Shouldn't it return a value? If instead this function were to return isize it would be a much simpler function. 

However, the logic of the function makes more sense if it is a optimization function. That is, it seeks to produce a more optimized version of the AST rather than evaluate the AST. But if that's the idea, your function takes the wrong type. It might make sense for the optimization function to take ownership of the AST, consuming the old AST reusing peices of it for the new AST. Or it might make sense to take a mutable reference to the AST, modifying the AST to make a more optimized version. 


  Is there any way to make this program more concise/cleaner? I think I understand why all the additional wrapping and sprinkling of Rc::clone/new and lots of reference taking is needed, but was wondering if I was perhaps missing something that might make this code cleaner to read. 


Yes, if you follow my advice aboev you'll find the code a lot more concise and cleaner.