Dragon Dictate (or Mavericks Dictation): How do they work? Do they have an API?
http://voicecode.io does exactly what you are describing here and is for Mac. It allows you to extend its grammar resulting in very efficient voice control for programmers.
*disclaimer - I'm the creator of VoiceCode