Certainly writing a front-end to a SPICE simulator is more practical (as pointed out in the comments), but if you're really interested in the nitty-gritty details:
One common tool for performing computational circuit analysis is using modified nodal analysis (MNA). This is a slight variation of nodal analysis to systematically setup voltage sources by adding an unknown current through the voltage source that needs to be solved for. Erik Cheever has a nice set of pages on how to do this for basic DC circuits, as well as how to extend this to steady-state AC and dependent sources.
Transient simulations and non-linear components are a bit funner (harder) to handle. One approach to simulate transients is to make approximations of how transient components behave, and do a dc solve/integrate over time process. For example, here is a post of how I approximated capacitors and inductors to simulate transmission line effects (yes, I know there are better models than the most basic conceptual model, but none really capture the interior).
Non-linear components simply modify the solve step: instead of solving a linear system of equations, you must now solve a non-linear system using some technique such as the Newton-Raphson method. These methods work best when you don't provide discontinuous responses (i.e. use an exponential to approximate a diode V-I curve instead of a step function, etc.).
An alternative approach to MNA is sparse tableau analysis. I personally don't have much, if any experience with this approach other than knowing it exists. More notes on MNA and sparse tableau analysis can be found here.