allow parsing of incomplete programs

Added the ability to parse incomplete programs, and added a new element to allow external code to detect the end of the incomplete program. Parameters have been added with default values to make it compatible with excisting code, and to keep it simple.