Multiphase single pass interpreter
OwnerBruce Hodgeinventor
Life of this patent
Estimating the term…
Abstract
A multiphase single pass interpreter switches modes of execution. The interpreter scans a program file in a scan phase until a tag signaling the presence of a script language is encountered. The interpreter then switches its mode to full parse phase where each line scanned is tokenized and parsed. Tokens are replaced with their dynamic content, if any. When the interpreter detects logic blocks, the interpreter changes its mode to p-code generation phase and generates p-code for the lines of code within the logic block. The generated p-code is then executed by the interpreter in its p-code execution phase. The interpretation is performed in a single pass through the program file.
Claims15
A method of interpreting a code, comprising:
- scanning a stream of characters;
- converting the scanned stream of characters into a stream of tokens, if the stream of characters represent a start tag of a script;
- if the stream of characters represent a start tag of a script,
- lexing, parsing, and executing one or more streams of characters following the start tag;
- if the one or more streams of characters represent a control logic block,
- generating p-code associated with one or more streams of characters within the control logic block and executing the generated p-code;
- and
- repeating the lexing, parsing, and executing step and the generating p-code step until a token representing a stop tag of the script is detected.
A multiphase single pass interpreter tangibly embodied on a computer readable medium, comprising:
- a lexical analyzer to receive a character stream and to convert the character stream into a token, if the stream of characters represent a start tag of a script;
- a parser to receive one or more of the tokens from the lexical analyzer;
- a p-code generator to receive the one or more of the parsed tokens to generate p-code associated with the one or more of the parsed tokens;
- and
- an executor to execute the generated p-code,
- wherein the lexical analyzer, the parser, the p-code generator, and the executor switch functioning phases during a single pass through a script.
A method of interpreting a code, comprising:
- scanning one or more characters of a code, in a scan phase;
- if a script start tag is scanned, converting the scanned stream of characters into a stream of tokens, switching to a full parse phase to fully lexan, parse, and execute one or more instructions following the start tag;
- if a conditional block is scanned following the start tag, switching to p-code generation phase to generate p-code for one or more instructions within the conditional block, and switching to p-code execution phase to execute the p-code.
A program storage device readable by machine, tangibly embodying a program of instructions executable by the machine to perform method steps of interpreting a code, comprising:
- scanning a stream of characters;
- converting the scanned stream of characters into a stream of tokens, if the stream of characters represent a start tag of a script;
- if the stream of characters represent a start tag of a script,
- lexing, parsing, and executing one or more streams of characters following the start tag;
- if the one or more streams of characters represent a control logic block,
- generating p-code associated with one or more streams of characters within the control logic block and executing the generated p-code;
- and
- repeating the lexing, parsing, and executing step and the generating p-code step until a token representing a stop tag of the script is detected.
A program storage device readable by machine, tangibly embodying a program of instructions executable by the machine to perform method steps of interpreting a code, comprising:
- scanning one or more characters from a code, in a scan phase;
- if a script start tag is scanned, converting the scanned stream of characters into a stream of tokens, switching to a full parse phase to fully scan, parse, and execute one or more instructions following the start tag;
- if a conditional block is scanned following the start tag, switching to a p-code generation phase to generate p-code for one or more instruction within the conditional block, and switching to a p-code execution phase to execute the p-code.
Dependencies are inferred from the claim text.