Can someone explain to me Feyman Kac and walk through an example? I kind of understand what needs to be done to convert an SDE to a PDE but I don't understand why we're allowed to do it.  What is the generator?
ie: given $dS(t) = rS(t)dt + \sigma S(t)dB(t)$ we get generator $\mathcal{A} : rx \frac{d}{dx} + \frac{1}{2} \sigma^2 x^2 \frac{d^2}{dx^2}$
I feel like I missed something in lecture.
 A: This is somehow lengthy and maybe to general for what you want to know, but I think it gives a good insight of the theory. The most of what follows I learned in my stochastic calculus course.

$\mathbf{Definition}$ We call a family $\{K_t:t\ge 0\}$ of stochastic kernels on a metric space $(X,d)$ a transition semigroup on $(X,d)$ if

*

*$K_0(x,A)=\mathbf1_{A}(x)$ for $x\in X$ and $A\in\mathcal{B}(X)$.

*$K_sK_t=K_{s+t}$, where $K_sK_t(x,A):=\int_XK_s(x,dy)K_t(y,A)$

Then you can also define $(K_h f)(x):=\int_XK_h(x,dy)f(y)$ for $f$ measurable and bounded or positive.
Then you can define a Markov Process in the usual way, i.e. it has to satisfy $P(X_{t+h }\in A|\mathcal{F}_t)=K_h(X_t,A)$. One can extend this to

$\mathbf{Definition}$ A transition semigroup $\{K_t:t\ge 0\}$ is called a Feller-semigroup if
$$\lim_{h\downarrow 0}K_hf(x)=f(x)$$
for all $x\in X$ and $f\in C_b$ (bounded and continuous functino on $X$) and in addition $K_tf\in C_0$ for every $f\in C_0$ (continuous function vanishing at infinity).

Just as a side remark, we call all a Markov Process, with corresponding Feller transition semigroup a Feller-Process. It can be shwon that every RCLL Feller Process has the strong Markov property.
We need the definition of a Feller semigroup to define a generator:

$\mathbf{Definition}$ Let $\{K_t:t\ge 0\}$ be a Feller semigroup, then
$$\mathcal{D}_A:=\{f\in C_0:\exists \lim_{h\downarrow 0}\frac{1}{h}(K_hf-f)=:Af\}$$
where the limit is in $C_0(X)$. Then $A:\mathcal{D}_A\to C_0(X)$ is called generator of $\{K_t:t\ge 0\}$.

One way to compute the generator is then (and this is also often a definition)
$$\lim_{h\downarrow 0}\frac{1}{h}E[f(X_{t+h})-f(X_t)|\mathcal{F}_t]$$
Therefore the generator $A$ describes the local behaviour of a Markov Process.
If you have a diffusion process
$$X_t:=\mu(X_t)dt+\sigma(X_t)dW_t$$
Then $X_t$ is Feller-process, and it can be shown that the generator is given by
$$Af(t,x):=\sum_i\mu_i(x)\frac{\partial f}{\partial x^i}(t,x)+\frac{1}{2}\sum_{i,j}(\sigma(x)\sigma(x)^{tr})_{i,j}\frac{\partial^2f}{\partial x^i\partial x^j}(t,x)$$
see the link of the Wikipedia site in my comment. Of course in the one-dimensional case this formula simplifies a lot.
Switch to your example. We have
$$dS_t=S_t(rdt+\sigma dB_t)$$
and a initial condition $S_r=s$, where $t\in[r,T]$. The generator would be
$$Af(t,x)=rx\frac{\partial f(t,x)}{\partial x}+\frac{1}{2}\sigma^2x^2\frac{\partial ^2f(t,x)}{\partial x^2}$$
For a sufficiently smooth function $f(t,x)$ we can apply Itô's Lemma to $f(t,S_t)$ to get
$$df(t,S_t)=\frac{\partial f}{\partial t}(t,S_t)dt+\frac{\partial f}{\partial x}(t,S_t)dS_t+\frac{1}{2}\frac{\partial f^2}{\partial x^2}(t,S_t)d\langle S_t\rangle=\frac{\partial f}{\partial t}(t,S_t)dt+\frac{\partial f}{\partial x}(t,S_t)dS_t+\frac{1}{2}\frac{\partial f^2}{\partial x^2}(t,S_t)\sigma^2S_t^2dt$$
Using the dynamics of $S_t$ gives
$$df(t,S_t)=\frac{\partial f}{\partial t}(t,S_t)dt+\frac{\partial f}{\partial x}(t,S_t)S(t)(rdt+\sigma dB_t)+ \sigma^2S_t^2\frac{1}{2}\frac{\partial f^2}{\partial x^2}(t,S_t)dt$$
collecting terms
$$df(t,S_t)=S_t\sigma\frac{\partial f}{\partial x}(t,S_t)dB_t+\left[S_tr\frac{\partial f}{\partial x}(t,S_t)+\frac{\partial f}{\partial t}(t,S_t)+\sigma^2S_t^2\frac{1}{2}\frac{\partial f^2}{\partial x^2}(S_t)\right]dt$$
If $f$ satisfies
$$Af(t,x)+\frac{\partial f}{\partial t}(t,x)=0$$
and $f(T,\cdot)=h(\cdot)$ for a given function $h$. Then all the $dt$ terms vanish. On the other hand you are left with $df(S_t)=S_t\sigma dB_t=\sigma(S_t)dB_t$, where $\sigma(x)=\sigma x$. Now if $\sigma(x)$ and $\frac{\partial f}{\partial x}$ are sufficiently integrable $f(t,S_t)$ is a martingale. Hence $E[f(t,S_t)]=E[h(S_T)]=f(r,s)$.
Furthermore, one can extend this to PDE's of the form $\frac{\partial f}{\partial t}+Af(t,x)+c(t,x)u=0$ for given function $c(t,x)$ and again terminal condition $f(T,\cdot)=h(\cdot)$. In this case we would have $f(r,s)=E[h(S_T)\exp{(\int_r^Tc(s,S_s)ds})] $. Also for PDE's of the form $\frac{\partial f}{\partial t}+Af(t,x)+c(t,x)u=g(t,x)$ with same terminal condition as above and a known function $g(t,x)$ similar expression for $f(r,s)$ holds.
Hence you see the connection of SDE theory and PDE theory. Computationally it is also very nice, since an expectation can be efficiently estimated using Monte-Carlo methods.
