# US 2007/0022414 A1 · Direct execution virtual machine

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2007/0022414 A1
- Document ID: US20070022414A1
- Status: Published application
- Kind: A1
- Application number: 11/492,274
- Filed: 2006-07-25
- Published: 2007-01-25
- Earliest claimed: 2005-07-25
- Assignees: Hercules Software, LLC
- Inventors: Peter Bird
- Web page: https://patentgrep.com/patent/US20070022414A1

## CPC

- G06F 8/427: {Parsing}
- G06F 9/45508: {Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for parsing and executing a software program includes receiving a portion of a software program in an original linguistic form, wherein the portion of the software program includes a nonlinear program element having a body, and, while retaining the original linguistic form, directly executing the nonlinear program element by manipulating a parse state and an input stream of tokens representing the body of the nonlinear program element, wherein directly executing comprises executing tokens until the dynamic end of the nonlinear program element is reached. A system includes a tokenizer operable to tokenize the software program and a parser operable to directly execute a nonlinear program element in the software program by manipulating a parse state and an input stream of tokens representing the body of the nonlinear program element, while preserving the original linguistic form of the software program.

## Claims

### Claim 1

A computer-readable medium having computer-executable instructions implementing a parser that has multiple parse states, wherein, when the instructions are executed by a computer, the instructions cause the computer to perform a process comprising:
receiving a portion of a software program in an original linguistic form, wherein the portion of the software program includes a nonlinear program element having a body; and
while retaining the original linguistic form, directly executing the nonlinear program element by manipulating a parse state and an input stream of tokens representing the body of the nonlinear program element, wherein directly executing comprises executing tokens until the dynamic end of the nonlinear program element is reached.

### Claim 2 (depends on 1)

The computer-readable medium as recited in claim 1, wherein the nonlinear program element comprises a function.

### Claim 3 (depends on 2)

The computer-readable medium as recited in claim 2, wherein directly executing the nonlinear program element comprises:
marking a parse stack index;
inserting a token stream representing the body of the function at the head of the input token stream;
resetting the parse stack index after directly executing the inserted executed body of the function; and
removing any unexecuted tokens from the input token stream.

### Claim 4 (depends on 3)

The computer-readable medium as recited in claim 3, further comprising forming an iterator comprising tokens of the token stream.

### Claim 5 (depends on 1)

The computer-readable medium as recited in claim 1, wherein the nonlinear program element comprises a loop construct.

### Claim 6 (depends on 1)

The computer-readable medium as recited in claim 1, wherein directly executing the nonlinear program element comprises:
inserting the executed body of the loop construct at the head of the input token stream; and
directly executing the body of the loop construct until the loop execution ends.

### Claim 7 (depends on 6)

The computer-readable medium as recited in claim 6, further comprising forming an iterator comprising tokens representing the body of the loop construct.

### Claim 8 (depends on 1)

The computer-readable medium as recited in claim 1, wherein the nonlinear program element comprises an exception handler having a try clause and a catch clause, the process further comprising:
marking the beginning of the try clause in the parse stack; and
upon detection of exception in the try clause, finding the mark point in the parse stack for the exception handler and discarding all tokens up to the end of the try clause.

### Claim 9 (depends on 1)

The computer-readable medium as recited in claim 1, wherein directly executing the nonlinear program element comprises table-driven parsing of the portion of the software program.

### Claim 10 (depends on 1)

The computer-readable medium as recited in claim 1, wherein directly executing the nonlinear program element comprises parsing the portion of the software program with a parser implemented using one or more recursive parsing functions.

### Claim 11 (depends on 10)

The computer-readable medium as recited in claim 10, wherein the one or more recursive parsing functions are mutually recursive.

### Claim 12 (depends on 1)

The computer-readable medium as recited in claim 1, further comprising injecting a token in the input token stream in a parser to facilitate runtime type conversion.

### Claim 13 (depends on 1)

The computer-readable medium as recited in claim 1, further comprising injecting a token in the input token stream in a parser to facilitate runtime program flow control.

### Claim 14

A method for parsing and executing a software program, the method comprising:
receiving a portion of the software program in an original linguistic form, wherein the portion of the software program includes a nonlinear program element having a body; and
while retaining the original linguistic form of the software program, directly executing the nonlinear program element by manipulating a parse state and an input stream of tokens representing the body of the nonlinear program element, wherein directly executing comprises executing tokens until the dynamic end of the nonlinear program element is reached.

### Claim 15 (depends on 14)

The method as recited in claim 14, wherein the nonlinear program element comprises a function.

### Claim 16 (depends on 15)

The method as recited in claim 15, wherein directly executing the nonlinear program element comprises:
marking a parse stack index;
inserting a token stream representing the body of the function at the head of the input token stream;
resetting the parse stack index after directly executing the inserted executed body of the function; and
removing any unexecuted tokens from the input token stream.

### Claim 17 (depends on 16)

The method as recited in claim 16, further comprising forming an iterator comprising tokens of the token stream.

### Claim 18 (depends on 14)

The method as recited in claim 14, wherein the nonlinear program element comprises a loop construct.

### Claim 19 (depends on 14)

The method as recited in claim 14, wherein directly executing the nonlinear program element comprises:
inserting the executed body of the loop construct at the head of the input token stream; and
directly executing the body of the loop construct until the loop execution ends.

### Claim 20 (depends on 19)

The method as recited in claim 19, further comprising forming an iterator comprising tokens representing the body of the loop construct.

### Claim 21 (depends on 14)

The method as recited in claim 14, wherein the nonlinear program element comprises an exception handler having a try clause and a catch clause, the process further comprising:
marking the beginning of the try clause in the parse stack; and
upon detection of exception in the try clause, finding the mark point in the parse stack for the exception handler and discarding all tokens up to the end of the try clause.

### Claim 22 (depends on 14)

The method as recited in claim 14, wherein directly executing the nonlinear program element comprises table-driven parsing of the portion of the software program.

### Claim 23 (depends on 14)

The method as recited in claim 14, wherein directly executing the nonlinear program element comprises parsing the portion of the software program with a parser implemented using one or more recursive parsing functions.

### Claim 24 (depends on 23)

The method as recited in claim 23, wherein the one or more recursive parsing functions are mutually recursive.

### Claim 25 (depends on 14)

The method as recited in claim 14, further comprising injecting a token in the input token stream in a parser to facilitate runtime type conversion.

### Claim 26 (depends on 14)

The method as recited in claim 14, further comprising injecting a token in the input token stream in a parser to facilitate runtime program flow control.

### Claim 27

A system for parsing and executing an input software program written in an original linguistic form, the system comprising:
a tokenizer operable to tokenize the software program;
a parser operable to directly execute a nonlinear program element in the software program by manipulating a parse state and an input stream of tokens representing the body of the nonlinear program element, while preserving the original linguistic form of the software program.

### Claim 28 (depends on 27)

The system as recited in claim 27, wherein the nonlinear program element comprises a function.

### Claim 29 (depends on 28)

The system as recited in claim 28, wherein the parser is further operable to:
mark a parse stack index;
insert a token stream representing the body of the function at the head of the input token stream;
reset the parse stack index after directly executing the inserted executed body of the function; and
remove any unexecuted tokens from the input token stream.

### Claim 30 (depends on 29)

The system as recited in claim 29, wherein the parser is further operable to form an iterator comprising tokens of the token stream representing the body of the function.

### Claim 31 (depends on 27)

The system as recited in claim 27, wherein the nonlinear program element comprises a loop construct.

### Claim 32 (depends on 27)

The system as recited in claim 27, wherein the parser is further operable to:
insert the executed body of the loop construct at the head of the input token stream; and
directly execute the body of the loop construct until the loop execution ends dynamically.

### Claim 33 (depends on 32)

The system as recited in claim 32, wherein the parser is further operable to form an iterator comprising tokens representing the body of the loop construct.

### Claim 34 (depends on 27)

The system as recited in claim 27, wherein the nonlinear program element comprises an exception handler having a try clause and a catch clause, and wherein the parser is further operable to:
mark the beginning of the try clause in the parse stack; and
upon detection of an exception in the try clause, finding the mark point in the parse stack for the exception handler and discarding all tokens up to the end of the try clause.

### Claim 35 (depends on 27)

The system as recited in claim 27, wherein the parser is table-driven.

### Claim 36 (depends on 27)

The system as recited in claim 27, wherein the parser comprises one or more recursive parsing functions.

### Claim 37 (depends on 36)

The system as recited in claim 36, wherein the one or more recursive parsing functions are mutually recursive.

### Claim 38 (depends on 27)

The system as recited in claim 27, wherein the parser is further operable to inject a token in the input token stream to facilitate runtime type conversion.

### Claim 39 (depends on 27)

The system as recited in claim 27, wherein the parser is further operable to inject a token in the input token stream to facilitate runtime program flow control.
