Fatewright is an open-soure project to help you create your own custom (non-parser) text-based games, such as gamebooks or simple CYOA games.
NOTE: I will begin pushing the source code when it is reasonably useable. But the reference (also a work in progress) is already available.