1. A computer-implemented method for compiling and optimizing computer code and translating the computer source code from a first programming language into a second programming language, the method comprising: acquiring a first source code, the first source code being written in the first programming language; parsing, via one or more parsing expression grammar (PEG) modules and based on a first grammar associated with the first programming language determined by an augmented Backus-Naur Form (ABNF), the first source code to convert the first source code into a first abstract syntax tree (AST); converting the first AST into a first non-deterministic finite state machine (NFSM); converting the first NFSM into a first deterministic finite state machine (DFSM); optimizing the first DFSM by minimizing a number of states in a finite state machine and by twice reversing the edges of the first DFSM to produce a second NFSM using a standard powerset construction by constructing only the reachable states of the first DFSM to obtain an optimized DFSM; and converting, via at least the one or more PEG modules, the optimized DFSM into a second source code, the second source code being written in a second programming language wherein the second source code is a translation of the first source code; the converting the optimized DFSM including converting the optimized DFSM into a third NFSM, converting the third NFSM into a second AST, and recompiling the second AST into the second source code.