US20140289715A1 - Immutable parsing - Google Patents
Immutable parsing Download PDFInfo
- Publication number
- US20140289715A1 US20140289715A1 US14/294,107 US201414294107A US2014289715A1 US 20140289715 A1 US20140289715 A1 US 20140289715A1 US 201414294107 A US201414294107 A US 201414294107A US 2014289715 A1 US2014289715 A1 US 2014289715A1
- Authority
- US
- United States
- Prior art keywords
- immutable
- stack
- parsing
- parser
- parse tree
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Abandoned
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
Definitions
- Parsing systems enable programs to either recognize or transcribe patterns matching formal grammars.
- Today many parsing systems are written by hand while others are auto-generated. They are found in compilers, natural language processing, machine communication, protocols, computer security, and many other domains. In compilers, for instance, parsers are integral to many functions including versioning, ambiguity resolution, and error recovery, among other things.
- parsers can perform syntactic analysis to verify input syntax.
- a stream of characters is lexically analyzed to recognize a sequence of tokens such as keywords, operators, and identifiers, among others.
- these tokens are employed to generate a parse tree or a more compact abstract syntax tree (AST) as a function of a programming language grammar.
- the tree can be employed as a basis for subsequent processing including semantic analysis, optimization, and code generation.
- Mutability is a property of a programmatic construct that refers to an ability to change or be changed. For example, a type is mutable if the value of an instance of that type is allowed to change. By contrast, immutability refers to an inability to change. Accordingly, if the value of an instance of a type is not allowed to change, then the type is immutable.
- mutable structures are very seductive with respect to parsing, and more specifically parsing and an integrated development environment (IDE).
- IDE integrated development environment
- a parse tree or the like can be updated to include the additional code or alteration of current code.
- a single, updatable representation of the program is cached and/or persisted and synchronized with the most current program version.
- the subject disclosure pertains to immutable parsing. Rather than implementing parsing utilizing mutable structures that can change, immutable structures are employed that are not subject to change subsequent to creation. More specifically, parsing including lexical and syntactical analysis can be performed with respect to an immutable configuration comprising an immutable stack and input/lookahead buffer in accordance with an aspect of the disclosure. In addition, an immutable parse tree or the like can be the resultant output of such as system. Employment of immutable structures provides a degree of safety with respect to interaction with other processes, services or the like since parser state cannot be unintentionally altered.
- parsing performance can be improved since immutable structures are amenable to multithreading and can therefore leverage benefits afforded by concurrent or parallel processing.
- Other advantages associated with immutable structures include trivial versioning and backtracking, among other things.
- the performance or resource utilization hit related to saving multiple immutable versions can be substantially mitigated by sharing and/or lazy computation.
- FIG. 1 is a block diagram of an immutable parse system according to an aspect of the disclosed subject matter.
- FIG. 2 is a block diagram of a representative parser configuration in accordance with a disclosed aspect.
- FIG. 3 is a block diagram of a version system according to an aspect of the subject disclosure.
- FIGS. 4 a - d illustrate iterations of exemplary lexical analysis utilizing immutable structures.
- FIGS. 5 a - b graphically depict two exemplary stack configurations to aid understanding of aspects of the subject disclosure.
- FIG. 6 is a block diagram of an error recovery system in accordance with an aspect of the disclosed subject matter.
- FIG. 7 is a block diagram of an ambiguity resolution system according to an aspect of the disclosure.
- FIG. 8 is a block diagram of a system for effecting change with respect to immutable structures according to an aspect of the disclosure.
- FIG. 9 illustrates modification of an exemplary parse tree in accordance with aspects of the subject disclosure.
- FIG. 10 a is a block diagram of a lazy computation system in accordance with an aspect of the disclosure.
- FIG. 10 b is an exemplary parse tree to illustrate lazy computation according to a disclosed aspect.
- FIG. 11 is a block diagram of an immutable parse-tree interaction system in accordance with an aspect of the disclosure.
- FIG. 12 is a flow chart diagram of a method of parsing utilizing immutable structures in accordance with an aspect of the disclosure.
- FIG. 13 is a flow chart diagram of a method of recovering from error or resolving a conflict in accordance with a disclosed aspect.
- FIG. 14 is a flow chart diagram of an optimal incremental parsing method according to an aspect of the disclosure.
- FIG. 15 is a flow chart diagram of a method of interacting with an immutable structure according to a disclosed aspect.
- FIG. 16 is a schematic block diagram illustrating a suitable operating environment for aspects of the subject disclosure.
- FIG. 17 is a schematic block diagram of a sample-computing environment.
- Parsing systems operate on immutable parsing configurations each including an immutable stack and lookahead buffer.
- An immutable parse tree, or the like can be generated by a parsing system to capture results of lexical and/or syntactic analysis for subsequent processing. Construction of such immutable structures can involve sharing of common elements amongst previous versions to preserve resource utilization. Further, the immutable structures can be leveraged to enable safe passing of state information with respect to conflict resolution and/or error recovery, for example, as well as lazy, and/or concurrent processing, among other things.
- the system 100 includes a lexical analyzer component 110 (also known as a lexer) and a syntactic analyzer component 120 . These analyzers 110 and 120 perform parsing functionality with respect to an immutable parser configuration 115 and optionally produce an immutable parse tree that captures the results of analysis for subsequent processing.
- a lexical analyzer component 110 also known as a lexer
- a syntactic analyzer component 120 perform parsing functionality with respect to an immutable parser configuration 115 and optionally produce an immutable parse tree that captures the results of analysis for subsequent processing.
- the lexical analyzer component 110 receives or retrieves a source including a sequence of characters or the like.
- the source can either correspond to a natural or program language.
- the lexical analyzer component 110 can transform the source into a sequence of tokens, or blocks of characters, in accordance with a set of rules of a language grammar.
- the lexical analyzer component 110 can include a separate scanner and tokenizer component (not shown) to bifurcate functionality.
- the syntactic analyzer component 120 acquires a stream of tokens from the lexical analyzer that identifies valid as well as invalid sets of tokens or expressions in accordance with a grammar.
- the syntactic analyzer component 120 can produce a parse tree or the like (e.g., abstract syntax tree) that represents the structure of a source according to a language grammar.
- the lexical analyzer component 110 and/or syntactic analyzer component 120 operate on or with respect to immutable parser configurations 115 . Furthermore, the syntactic analyzer component 120 can construct an immutable parse tree.
- Immutability refers to an inability of a structure such as a type or object to change after construction or at least appear to the outside world not to change (e.g., logical immutability). Immutable types or the like are not a feature of most programming languages per se. However, immutability generally refers to a style of structure construction. Once a structure is constructed, it is not subsequently changed.
- parsing systems used mutability to achieve high performance.
- versioning becomes difficult as destructive updates prevent preservation of history of changes to a parse tree.
- IDEs integrated development environments
- IDEs integrated development environments
- an “undo” to a previous text version would cause a costly new reparse in order to bring an integrated compiler's internal structures up to date with a text buffer.
- the immutable parsing system 100 allows both parser and parser results to be associated with every text version in an efficient (both in time and memory) manner.
- FIG. 2 illustrates an exemplary immutable parser configuration 115 in accordance with an aspect of the claimed subject matter.
- the configuration 115 includes an immutable buffer 210 and an immutable stack 220 (both of which can be components as defined herein).
- the parser configuration 115 is an amalgamation of the buffer 210 and the stack 220 and is therefore immutable by construction.
- the immutable buffer 210 also referred to as an input buffer or lookahead buffer provides a sequence of characters or the like for parsing.
- the immutable buffer 210 can save buffer history to enable backtracking, for example.
- the immutable buffer component 210 can remember referenced history and remove or otherwise make referenced history available for garbage collection.
- the buffer 210 can appear to be modified by appending new input states to the front of the immutable structure thereby allowing the future to be changed.
- the immutable stack 220 records parsing history. It is employed to facilitate identification of tokens and expressions, among other things.
- the immutable stack can be nondeterministic, where stack items can point to “n” items rather than simply one item, although that is also possible.
- the stack 220 can be a special cactus stack.
- the stack can be a rooted, directed, acyclic graph with a single sink node. This enables the parser to hold onto multiple pasts similar to the immutable buffer 210 . Further yet, in accordance with an aspect, the stack 220 can appear to change by appending states to the end of the stack.
- the immutable parser configuration 115 can have the following interface:
- TInput can be implemented by a type such as the following:
- IChain ⁇ T> IEnumerable ⁇ T> ⁇ T Value ⁇ get; ⁇ IChain ⁇ T> Next ⁇ get; ⁇ IEnumerable ⁇ T> GetValuesUntil(IChain ⁇ T> exclusiveSentinel); ⁇
- an “IChain” that is a linked list comprising a value and a next that may or may not be materialized (lazy computation is possible).
- the “IChain” is implemented with an “IEnumerable,” which defers computation until iteration is performed over a collection.
- a lexer can return an “IEnumerable” of tokens from an input source. That means that it does not actually lex out the tokens until each token is called.
- an “IChain” is constructed out of an “IEnumerable” so that elements can be iterated through, but while also saving the history that has already been enumerated. In other words, “IEnumerable” only allows forward iteration, whereas “IChain” also allows backward iteration through previously iterated values.
- IStack can be implemented by a type as follows:
- IStackLink ⁇ A> A Value ⁇ get; set; ⁇ StateStack ⁇ A> Stack ⁇ get; ⁇ ⁇ public class StateStack ⁇ A> : IStackLink ⁇ A> ⁇ public StateStack(short state); public StateStack(StateStack ⁇ A> previous, short state, A value); public int DeterministicDepth ⁇ get; ⁇ public bool IsBottom ⁇ get; ⁇ public bool IsDeterministic ⁇ get; ⁇ public IEnumerable ⁇ IStackLink ⁇ A>> Links ⁇ get; ⁇ public StateStack ⁇ A> Stack ⁇ get; ⁇ public short State ⁇ get; ⁇ public A Value ⁇ get; set; ⁇ public void AddLink(IStackLink ⁇ A> link); public void InvalidateDeterministicDepth( ); public StateStack ⁇ A> Pop( ); public override string ToString( ); ⁇
- the immutable stack 220 can be implemented as an “IStackLink” providing a linked list of state stacks (“StateStack”).
- the state stacks are implemented as nondeterministic. Accordingly, a stack element can refer to more than one other element in a modified cactus form.
- the parser configuration 115 is composed of an immutable input buffer 210 and immutable, nondeterministic state stack 220 . Moreover, these two structures can be employed to represent a parser configuration at any point in time during a parse.
- version system 300 is illustrated in accordance with an aspect of the claimed subject matter. Where immutable structures are employed, there is a potential to utilize large amounts of memory to hold various versions. For example, a new version of an immutable stack is generated with each push or pop operation (or equivalent). Accordingly, version system 300 can be employed by one or more parse system components such as lexical analyzer 110 and syntactic analyzer 120 . As shown, the system 300 includes a shared element component 210 and a structure generation component 320 .
- the shared element component 310 identifies elements that are common to a first version and a yet to be produced second version.
- the communicatively coupled structure generation component 320 produces a new structure adding new elements and/or removing old elements, wherein shared elements need not be constructed but rather simply referenced or linked. However, in some instances parent elements can be rewritten. This significantly reduces resource utilization associated with producing multiple copies of immutable structures.
- FIGS. 4 a - d iterations of exemplary lexical analysis is illustrated utilizing immutable structures to facilitate clarity and understanding with respect to aspects of the claimed subject matter.
- there are one or more immutable stacks e.g., stack configuration
- one or more immutable buffers e.g., buffer configuration
- the buffers are populated with data in these examples, it is to be noted that such data can be realized lazily as needed.
- FIG. 4 a a single stack “stake 0” 410 is depicted as well as an input buffer “buffer 0” 420 .
- the stack 410 includes one element “a,” which is identified by a pointer into the input buffer 420 .
- FIG. 4 b shows a stack configuration including two stacks or versions “stack 0” 410 and “stack 1” 412 , where the latter references or links to the former.
- a new pointer is also generated identifying the second element in the input buffer 420 pointing to “b” that is embodied in “stack 1” 412 .
- FIG. 4 c adds another immutable stack or version “stack 2” 414 to the set of stacks linked to the pervious stack “stack 1” 412 in accordance with generation of a new pointer that points to character “c” captured “stack 2” 414 .
- 4 d illustrates yet another element that begets construction of a new stack “stack 3” 416 including the element “d” that is linked to “stack 2” 414 Moreover, another immutable buffer “buffer 1” 422 is created and linked to the previous buffer “buffer 0” 420 since the later had been processed. A new pointer is create and points to “d” which is added by generation of a new immutable stack “stack 3” 416 linked to the previous stack “stack 2” 414 .
- FIGS. 5 a - b illustrate further examples of interaction with immutable structures, namely immutable stacks to aid clarity and understanding with respect to aspects of the claimed subject matter.
- an immutable stack configuration 500 is shown where first “a” is pushed forming “stack 0”, then on that initial stack both “d” (“stack 1), and “b” (“stack 2”) then “c” (“stack 3”) are pushed.
- the stack configuration 500 provides an example of a cactus stack where both “stack 1” and “stack 2” point to “stack 0.” Where nodes “b” and “c” are subsequently removed stack configuration 510 results, including “stack 0” and “stack 1.” Furthermore, it is to be appreciated that where nodes “a,” “b,” and “c” are deleted, configuration 510 will still result since there is a copy of node “a” that corresponds to “b” and “c” and a copy that corresponds to “d.”
- FIG. 6 depicts an error recovery system 600 in accordance with an aspect of the claimed subject matter.
- the system 600 includes an error detection component 610 that identifies an error in a parsing process. Where the parser operates in the contexts of an IDE, errors are more a norm than an exception, since the parser is often operating over an incomplete program. However, errors are typically present with regularity complete programs and batch compilers as well.
- communicatively coupled recovery component 620 can resolve the error to allow parsing to continue, for example.
- the recovery component 620 can seek assistance from other methods, functions, services and/or the like.
- the recovery component 620 includes an interface component 622 that can communicate with an external recovery component 630 .
- the interface component 622 can provide the parser configuration at the time of the error to the external error recovery system 630 .
- the external recovery component 630 can subsequently determine a cause of the error and a strategy for recovering which can be communicated back to the recovery component 620 by way of interface component 622 .
- the strategy can identify changes that should be made to the configuration.
- Execution component 624 can execute or implement an identified strategy. For instance, the execution component 624 can generate a new immutable parser configuration to replace the old configuration.
- the error recovery system 600 operates in a safe manner. In one instance, since the configuration is immutable, it is safe for a parsing system to provide this information to another process without fear that the process will compromise the system. Safety is further added by reserving changes for solely the parsing system and seeking recovery strategies or recommendations, as opposed to allowing another method, process, service or the like to generate a new immutable type.
- FIG. 7 is a block diagram of an ambiguity resolution system 700 in accordance with an aspect of the claimed subject matter. Unlike errors in which no path is available for further processing, ambiguities or conflicts exist when there is more than one way to continue parsing.
- Conflict detection component 710 identifies such conflicts or ambiguities during parsing.
- Conflict resolution component 720 is a mechanism for resolving conflicts. While the conflict resolution component 720 can handle such resolution internally, it is also able to seek external assistance. To that end, the resolution component 720 includes an interface component 722 that interacts with an external conflict resolution component 730 .
- the external conflict resolution component can comprise a different method, function, process server or the like than that employed by a parser.
- the interface component 722 can transmit the current immutable parser configuration to the resolution component 730 . From the configuration, various functions and/or analysis are performed to determine how to resolve the conflict. In one embodiment, recovery strategies can be associated with particular parser configurations. Accordingly, the external resolution component need only match the current configuration to configuration associated with a strategy that identifies how to resolve the conflict. In any event, the identified strategy can be passed back to resolution component 720 by way of interface 722 . Subsequently, execution component 724 can execute or implement the conflict resolution strategy. For example, the current parser configuration can be altered.
- ambiguity resolution system 700 is analogous to the error recovery system 600 . Accordingly, the same safety benefits are afforded. In brief, safety is ensured by passing an immutable parser state and accepting resolution or recovery strategies as suggestions rather than allowing an external process or the like to directly alter parser state with respect to mutable and/or immutable structures.
- the system includes a change detection component 810 that identifies changes or desired changes. For example, consider parsing in an IDE context. Upon text edit (e.g., addition, removal, alteration), an immutable parse tree should be altered to reflect changes. More specifically, a new token stream is generated from which a new parse tree is constructed. The changed detection component 810 can identify such changes in text and initiate execution of token stream modification component 820 .
- the token stream modification component 820 determines which tokens are affected by an identified modification and accordingly need to be reprocessed. Given a start and end position of an edit, the token stream modification component 820 determines the first and last tokens this edit touches (including right at the edge). In accordance with one exemplary implementation, if the edit intersects tokens then it appends the parts of tokens not touched by the edit. This aligns everything and makes processing much easier since intra-token edits need not be handled. Now, the component 820 can determine text to scan or lex. This is based on the tokens to be rescanned as well as any new text.
- the token stream modification component 820 produces is a new immutable token stream that can share as many tokens with the previous token stream as possible.
- Parse tree modification component 830 utilizes the new immutable token stream to produce a new immutable parse tree that similarly shares as much as possible from the previous tree.
- nodes can be generated for each newly added token or syntactic expression.
- explicitly or implicitly data shared with a previous immutable tree is linked.
- parents of newly added children can be rewritten.
- FIG. 9 depicts graphically modification of an exemplary immutable parse tree to facilitate clarity with respect to aspects of the claimed subject matter.
- Original parse tree 910 includes root node “a” 911 with children “b” 912 and “c” 913 .
- the node “c” 913 also has two children “d” 914 and “e” 915 .
- the original tree 910 is to be modified to include node a new node “g” as a child of node “b” 912 .
- This provides new “modified” tree 920 .
- the modified tree 920 includes rewritten root “a′” 921 and child “b” 922 as well as the new node “g” 923 .
- the modified tree 920 need not include node “c” 913 and its children since it can be shared between versions and/or lazily computed to enable efficient memory utilization, among other things.
- a lazy computation system 1000 is illustrated in accordance with an aspect of the claimed subject matter.
- Immutable structures enable lazy computation. If things are immutable, they can be removed and subsequently reconstructed. In other words, since things are not changing whether or not they are in memory does not matter, because they can be reconstructed given that they are going to be the same.
- the system 1000 includes request interface component 1010 and constitution component 1020 .
- the request interface component 1010 receives or retrieves a request for data.
- the constitution component 1020 returns the requested data to the interface component 1010 . Where the data is not constituted or realized, it can be constituted or reconstituted. In other words, the data can be computed and saved in memory as needed in response to requests.
- FIG. 10 b depicts a partially constituted parse tree 1050 in accordance with an aspect of the claimed subject matter.
- the tree 1050 includes constituted or root node “A” 1060 with children “B” 1072 and “C” 1074 .
- the node “B” 1072 also includes two children “D” 1082 and “E” 1084 .
- the node “C” 1074 has two children “F” 1086 and “G” 1088 .
- the root node “A” 1060 and the sub-tree associated with node “B” 1072 are both constituted where as the sub-tree associated with node “C” 1074 is not realized. Accordingly, where a request concerns node “C” 1074 , “F” 1086 , and/or G” 1088 , such data will need to be constituted or computed.
- FIG. 11 illustrates a parse-tree interaction system 1100 in accordance with an aspect of the claimed subject matter.
- the system 1100 includes an interface component 1110 including one or more services 1112 communicatively coupled to an immutable parse tree 1120 .
- interface component 1110 can be implemented in a wrapper design pattern around the immutable parse tree 1120 .
- the interface component 1110 can be embodied as a view tree.
- the services 1112 acquire or compute information from the immutable tree 120 and provide such information back to a requesting entity.
- Immutability allows for safe sharing and duplication, among other things. Accordingly, parallelism and distribution are enabled. In particular, a copy cannot be differentiated from an original, which is okay, because they are not going to change anyway. For example, in context of parsing and an IDE code analysis may be desired, which can be potentially expensive. Immutable trees are useful here for at least two reasons. First, a copy of a parse tree can provided without having to worry about unexpected and/or undesirable changes. Second, the copy can be duplicated to allow parallel analysis. For instance, portions of a conditional statement can be analyzed concurrently. Furthermore, it should be noted that an “undo” operation in an IDE becomes trivial rather than very complex. In essence, “undo” simply involves referencing a different parser configuration, for example.
- various portions of the disclosed systems above and methods below can include or consist of artificial intelligence, machine learning, or knowledge or rule based components, sub-components, processes, means, methodologies, or mechanisms (e.g., support vector machines, neural networks, expert systems, Bayesian belief networks, fuzzy logic, data fusion engines, classifiers . . . ).
- Such components can automate certain mechanisms or processes performed thereby to make portions of the systems and methods more adaptive as well as efficient and intelligent.
- such mechanisms can be utilized to facilitate predictive computation and caching of portions of lazily computed structures to enable efficient processing. For instance, inferences can be made regarding a parse tree and contextual information that suggest that particular portions are likely to be needed soon.
- an initial immutable configuration including an immutable input buffer and stack are instantiated.
- a parsing operation is performed. For example, an identified element in the input buffer is analyzed in an attempt to produce a language valid token.
- a new immutable configuration namely a buffer and/or state is generated as needed. For instance, where an element is added to the stack or removed from the stack, a new immutable stack is generated to capture the change.
- the new stack can share common elements with the previous stack rather than include all elements in the new stack.
- FIG. 13 depicts a method 1300 of error recover/conflict resolution in accordance with an aspect of the claimed subject matter.
- an error or ambiguity is detected during parsing. An error is present when there is no path to continue parsing, whereas an ambiguity exists when there is more than one valid path.
- a parser configuration is passed to a recovery/resolution service, process, method or the like.
- a recover/resolution strategy is acquired at reference 1330 . For example, such strategy can identify changes to the parser configuration.
- a new parser configuration is generated in accordance with the strategy to recover from error or resolve a conflict or ambiguity. In this manner, the parser configuration is unable to be modified by a called service or the like since it passes an immutable copy and returns a strategy or recommendation regarding how to proceed rather than effecting the strategy.
- FIG. 14 illustrates an optimal incremental parsing method 1400 in accordance with an aspect of the claimed subject matter.
- an edit is detected to a stream of characters as a result of modifications made to a program in an editor during development, for example.
- tokens affected by the modification such as the first and last tokens are identified.
- a new immutable data structure that captures the token stream can be generated at reference 1630 .
- Generation can comprise scanning or lexing additional text and affected tokens to synchronize parsing state with an editor state, for instance.
- the newly generated structure(s) can maximally share as many tokens as possible with the previous structure(s).
- the sequence of tokens preceding the first changed token, and the sequence of tokens after the last changed tokens can be shared with “O(1)” time/space for the new token stream.
- the method 1600 can be used with a “history service,” as found in an IDE, for instance. Accordingly, the method 1600 is suitable for rich code (or text) editors that allow storing a history of all versions and edits, with very little time/space overhead. Further yet, the method 1600 is also suited for a heavily threaded environment.
- a new immutable parse tree can be constructed from the token stream.
- the new parse tree can share nodes with the previous version and/or be subject to lazy computation. For example, where a single node is added to a sub-tree, only that sub-tree needs to be saved or materialized. Other sub-trees can be shared or later computed lazily on an as needed basis.
- FIG. 15 is a flow chart diagram of a method of interaction with an immutable structure 1500 according to a claimed aspect.
- a request is received with respect to an immutable structure such as a parse tree.
- the structure is interacted with to determine a response to the request, and the response is returned to a requesting entity at reference 1530 .
- method 1500 can be embodied as an interface, wrapper, or view of an immutable tree structure.
- the method 1500 can operate with respect to a single version of an immutable structure. Additionally or alternatively, the method 1500 can operate across multiple versions.
- parsing or various forms thereof (e.g., parse, parser, parsed, parses . . . ) is intended to refer to a process associated with lexical and/or syntactic analysis, unless otherwise explicitly noted. Accordingly, where used “parser” can encompass and/or refer to a conventional parser comprising complete lexical and syntactic analysis or a sub-component thereof such as a scanner, lexer, tokenizer, or the like. For example, a lexer can be viewed as a very simple parser.
- the term “inference” or “infer” refers generally to the process of reasoning about or inferring states of the system, environment, and/or user from a set of observations as captured via events and/or data. Inference can be employed to identify a specific context or action, or can generate a probability distribution over states, for example. The inference can be probabilistic—that is, the computation of a probability distribution over states of interest based on a consideration of data and events. Inference can also refer to techniques employed for composing higher-level events from a set of events and/or data.
- Such inference results in the construction of new events or actions from a set of observed events and/or stored event data, whether or not the events are correlated in close temporal proximity, and whether the events and data come from one or several event and data sources.
- Various classification schemes and/or systems e.g., support vector machines, neural networks, expert systems, Bayesian belief networks, fuzzy logic, data fusion engines . . . ) can be employed in connection with performing automatic and/or inferred action in connection with the subject innovation.
- all or portions of the subject innovation may be implemented as a method, apparatus or article of manufacture using standard programming and/or engineering techniques to produce software, firmware, hardware, or any combination thereof to control a computer to implement the disclosed innovation.
- article of manufacture as used herein is intended to encompass a computer program accessible from any computer-readable device or media.
- computer readable media can include but are not limited to storage devices such as magnetic devices (e.g., hard disk, floppy disk, magnetic strips . . . ), optical disks (e.g., compact disk (CD), digital versatile disk (DVD) . . . ), smart cards, and flash memory devices (e.g., card, stick, key drive . . . ).
- a carrier wave can be employed to carry computer-readable electronic data such as those used in transmitting and receiving electronic mail or in accessing a network such as the Internet or a local area network (LAN).
- LAN local area network
- FIGS. 16 and 17 are intended to provide a brief, general description of a suitable environment in which the various aspects of the disclosed subject matter may be implemented. While the subject matter has been described above in the general context of computer-executable instructions of a program that runs on one or more computers, those skilled in the art will recognize that the subject innovation also may be implemented in combination with other program modules. Generally, program modules include routines, programs, components, data structures, etc. that perform particular tasks and/or implement particular abstract data types.
- an exemplary environment 1610 for implementing various aspects disclosed herein includes a computer 1612 (e.g., desktop, laptop, server, hand held, programmable consumer or industrial electronics . . . ).
- the computer 1612 includes a processing unit 1614 , a system memory 1616 , and a system bus 1618 .
- the system bus 1618 couples system components including, but not limited to, the system memory 1616 to the processing unit 1614 .
- the processing unit 1614 can be any of various available microprocessors. It is to be appreciated that dual microprocessors, multi-core and other multiprocessor architectures can be employed as the processing unit 1614 .
- the system memory 1616 includes volatile and nonvolatile memory.
- the basic input/output system (BIOS) containing the basic routines to transfer information between elements within the computer 1612 , such as during start-up, is stored in nonvolatile memory.
- nonvolatile memory can include read only memory (ROM).
- Volatile memory includes random access memory (RAM), which can act as external cache memory to facilitate processing.
- Computer 1612 also includes removable/non-removable, volatile/nonvolatile computer storage media.
- FIG. 16 illustrates, for example, mass storage 1624 .
- Mass storage 1624 includes, but is not limited to, devices like a magnetic or optical disk drive, floppy disk drive, flash memory, or memory stick.
- mass storage 1624 can include storage media separately or in combination with other storage media.
- FIG. 16 provides software application(s) 1628 that act as an intermediary between users and/or other computers and the basic computer resources described in suitable operating environment 1610 .
- Such software application(s) 1628 include one or both of system and application software.
- System software can include an operating system, which can be stored on mass storage 1624 , that acts to control and allocate resources of the computer system 1612 .
- Application software takes advantage of the management of resources by system software through program modules and data stored on either or both of system memory 1616 and mass storage 1624 .
- the computer 1612 also includes one or more interface components 1626 that are communicatively coupled to the bus 1618 and facilitate interaction with the computer 1612 .
- the interface component 1626 can be a port (e.g., serial, parallel, PCMCIA, USB, FireWire . . . ) or an interface card (e.g., sound, video, network . . . ) or the like.
- the interface component 1626 can receive input and provide output (wired or wirelessly). For instance, input can be received from devices including but not limited to, a pointing device such as a mouse, trackball, stylus, touch pad, keyboard, microphone, joystick, game pad, satellite dish, scanner, camera, other computer, and the like.
- Output can also be supplied by the computer 1612 to output device(s) via interface component 1626 .
- Output devices can include displays (e.g., CRT, LCD, plasma . . . ), speakers, printers, and other computers, among other things.
- FIG. 17 is a schematic block diagram of a sample-computing environment 1700 with which the subject innovation can interact.
- the system 1700 includes one or more client(s) 1710 .
- the client(s) 1710 can be hardware and/or software (e.g., threads, processes, computing devices).
- the system 1700 also includes one or more server(s) 1730 .
- system 1700 can correspond to a two-tier client server model or a multi-tier model (e.g., client, middle tier server, data server), amongst other models.
- the server(s) 1730 can also be hardware and/or software (e.g., threads, processes, computing devices).
- the servers 1730 can house threads to perform transformations by employing the aspects of the subject innovation, for example.
- One possible communication between a client 1710 and a server 1730 may be in the form of a data packet transmitted between two or more computer processes.
- the system 1700 includes a communication framework 1750 that can be employed to facilitate communications between the client(s) 1710 and the server(s) 1730 .
- the client(s) 1710 are operatively connected to one or more client data store(s) 1760 that can be employed to store information local to the client(s) 1710 .
- the server(s) 1730 are operatively connected to one or more server data store(s) 1740 that can be employed to store information local to the servers 1730 .
- Client/server interactions can be utilized with respect with respect to various aspects of the claimed subject matter.
- one or more of the components and/or systems can be embodied as a network or web services provided by one or more servers 1730 to one or more clients 1710 across the communication framework 1750 .
- a parser system can transmit an immutable parser configuration across the communication framework 1750 to server based error-recovery or conflict-resolution service, which determines a strategy and passes it back to the parser system for implementation.
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Immutable structures are employed to effect immutable parsing. In particular, a parsing configuration, comprising a stack and lookahead buffer, is utilized by a parser to perform lexical and syntactical analysis of an input stream and optionally output an immutable parse tree or the like, wherein at least one of the stack and buffer is immutable. Performance with respect to the immutable structures can be optimized utilizing sharing and lazy computation. In turn, immutability benefits are afforded with respect to parsing including safe sharing amongst services and/or across multiple threads as well as history preservation, among other things.
Description
- This application is a continuation of U.S. application Ser. No. 12/187,753 filed Aug. 7, 2008, the entirety of which is incorporated herein by reference.
- Parsing systems enable programs to either recognize or transcribe patterns matching formal grammars. Today many parsing systems are written by hand while others are auto-generated. They are found in compilers, natural language processing, machine communication, protocols, computer security, and many other domains. In compilers, for instance, parsers are integral to many functions including versioning, ambiguity resolution, and error recovery, among other things.
- More specifically, parsers can perform syntactic analysis to verify input syntax. A stream of characters is lexically analyzed to recognize a sequence of tokens such as keywords, operators, and identifiers, among others. Often, these tokens are employed to generate a parse tree or a more compact abstract syntax tree (AST) as a function of a programming language grammar. The tree can be employed as a basis for subsequent processing including semantic analysis, optimization, and code generation.
- Typically, mutability is leveraged at least implicitly to optimize programs including parsing systems in terms of resource utilization and performance. Mutability is a property of a programmatic construct that refers to an ability to change or be changed. For example, a type is mutable if the value of an instance of that type is allowed to change. By contrast, immutability refers to an inability to change. Accordingly, if the value of an instance of a type is not allowed to change, then the type is immutable.
- Resource utilization is optimized by simply modifying or updating current structures as needed as opposed to generating multiple copies. For instance, mutable structures are very seductive with respect to parsing, and more specifically parsing and an integrated development environment (IDE). By way of example, as a user enters code into an editor of an IDE, a parse tree or the like can be updated to include the additional code or alteration of current code. Stated differently, a single, updatable representation of the program is cached and/or persisted and synchronized with the most current program version.
- As per performance optimization, at least one of two approaches is taken conventionally. First, algorithms are developed that perform synchronous processing faster (e.g., quick sort, bubble sort . . . ) with the implicit understanding that constructs are mutable. Once a good algorithm is established, programmatic statements and/or instructions are analyzed and hacked. In other words, there is a lot of lower level instruction alteration and/or bit twiddling.
- The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed subject matter. This summary is not an extensive overview. It is not intended to identify key/critical elements or to delineate the scope of the claimed subject matter. Its sole purpose is to present some concepts in a simplified form as a prelude to the more detailed description that is presented later.
- Briefly described, the subject disclosure pertains to immutable parsing. Rather than implementing parsing utilizing mutable structures that can change, immutable structures are employed that are not subject to change subsequent to creation. More specifically, parsing including lexical and syntactical analysis can be performed with respect to an immutable configuration comprising an immutable stack and input/lookahead buffer in accordance with an aspect of the disclosure. In addition, an immutable parse tree or the like can be the resultant output of such as system. Employment of immutable structures provides a degree of safety with respect to interaction with other processes, services or the like since parser state cannot be unintentionally altered. Furthermore, parsing performance can be improved since immutable structures are amenable to multithreading and can therefore leverage benefits afforded by concurrent or parallel processing. Other advantages associated with immutable structures include trivial versioning and backtracking, among other things. Still further yet, in accordance with an aspect of the disclosure, the performance or resource utilization hit related to saving multiple immutable versions can be substantially mitigated by sharing and/or lazy computation.
- To the accomplishment of the foregoing and related ends, certain illustrative aspects of the claimed subject matter are described herein in connection with the following description and the annexed drawings. These aspects are indicative of various ways in which the subject matter may be practiced, all of which are intended to be within the scope of the claimed subject matter. Other advantages and novel features may become apparent from the following detailed description when considered in conjunction with the drawings.
-
FIG. 1 is a block diagram of an immutable parse system according to an aspect of the disclosed subject matter. -
FIG. 2 is a block diagram of a representative parser configuration in accordance with a disclosed aspect. -
FIG. 3 is a block diagram of a version system according to an aspect of the subject disclosure. -
FIGS. 4 a-d illustrate iterations of exemplary lexical analysis utilizing immutable structures. -
FIGS. 5 a-b graphically depict two exemplary stack configurations to aid understanding of aspects of the subject disclosure. -
FIG. 6 is a block diagram of an error recovery system in accordance with an aspect of the disclosed subject matter. -
FIG. 7 is a block diagram of an ambiguity resolution system according to an aspect of the disclosure. -
FIG. 8 is a block diagram of a system for effecting change with respect to immutable structures according to an aspect of the disclosure. -
FIG. 9 illustrates modification of an exemplary parse tree in accordance with aspects of the subject disclosure. -
FIG. 10 a is a block diagram of a lazy computation system in accordance with an aspect of the disclosure. -
FIG. 10 b is an exemplary parse tree to illustrate lazy computation according to a disclosed aspect. -
FIG. 11 is a block diagram of an immutable parse-tree interaction system in accordance with an aspect of the disclosure. -
FIG. 12 is a flow chart diagram of a method of parsing utilizing immutable structures in accordance with an aspect of the disclosure. -
FIG. 13 is a flow chart diagram of a method of recovering from error or resolving a conflict in accordance with a disclosed aspect. -
FIG. 14 is a flow chart diagram of an optimal incremental parsing method according to an aspect of the disclosure. -
FIG. 15 is a flow chart diagram of a method of interacting with an immutable structure according to a disclosed aspect. -
FIG. 16 is a schematic block diagram illustrating a suitable operating environment for aspects of the subject disclosure. -
FIG. 17 is a schematic block diagram of a sample-computing environment. - Systems and methods pertaining to immutable parsing are described in detail hereinafter. Parsing systems operate on immutable parsing configurations each including an immutable stack and lookahead buffer. An immutable parse tree, or the like, can be generated by a parsing system to capture results of lexical and/or syntactic analysis for subsequent processing. Construction of such immutable structures can involve sharing of common elements amongst previous versions to preserve resource utilization. Further, the immutable structures can be leveraged to enable safe passing of state information with respect to conflict resolution and/or error recovery, for example, as well as lazy, and/or concurrent processing, among other things.
- Various aspects of the subject disclosure are now described with reference to the annexed drawings, wherein like numerals refer to like or corresponding elements throughout. It should be understood, however, that the drawings and detailed description relating thereto are not intended to limit the claimed subject matter to the particular form disclosed. Rather, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the claimed subject matter.
- Referring initially to
FIG. 1 , an immutable parsesystem 100 is illustrated in accordance with an aspect of the claimed subject matter. Thesystem 100 includes a lexical analyzer component 110 (also known as a lexer) and asyntactic analyzer component 120. Theseanalyzers immutable parser configuration 115 and optionally produce an immutable parse tree that captures the results of analysis for subsequent processing. - The
lexical analyzer component 110 receives or retrieves a source including a sequence of characters or the like. For example, the source can either correspond to a natural or program language. Upon source acquisition, thelexical analyzer component 110 can transform the source into a sequence of tokens, or blocks of characters, in accordance with a set of rules of a language grammar. In one instance, thelexical analyzer component 110 can include a separate scanner and tokenizer component (not shown) to bifurcate functionality. - The
syntactic analyzer component 120 acquires a stream of tokens from the lexical analyzer that identifies valid as well as invalid sets of tokens or expressions in accordance with a grammar. Optionally, thesyntactic analyzer component 120 can produce a parse tree or the like (e.g., abstract syntax tree) that represents the structure of a source according to a language grammar. - Unlike conventional parsers and/or lexers, the
lexical analyzer component 110 and/orsyntactic analyzer component 120 operate on or with respect toimmutable parser configurations 115. Furthermore, thesyntactic analyzer component 120 can construct an immutable parse tree. Immutability refers to an inability of a structure such as a type or object to change after construction or at least appear to the outside world not to change (e.g., logical immutability). Immutable types or the like are not a feature of most programming languages per se. However, immutability generally refers to a style of structure construction. Once a structure is constructed, it is not subsequently changed. - Conventionally, parsing systems used mutability to achieve high performance. However, this leads to several problems. First, a single parser cannot be shared across multithreads or documents precluding performance gains available through highly concurrent systems. Second, versioning becomes difficult as destructive updates prevent preservation of history of changes to a parse tree. Third, providing extensibility points that are safe is difficult because any user callouts can potentially corrupt the state of a parser system. Fourth, non-determinism and speculative processes typically involve backtracking and the presence of mutable data radically complicates mutable systems. Further, immutable systems enable new performance optimizations such as sharing and lazy computation that are not available to their mutable counterparts.
- For example, integrated development environments (IDEs), provide “undo” services to allow users to revisit previous version of their text files. With a destructive parsing system, an “undo” to a previous text version would cause a costly new reparse in order to bring an integrated compiler's internal structures up to date with a text buffer. The
immutable parsing system 100 allows both parser and parser results to be associated with every text version in an efficient (both in time and memory) manner. - Another example is a typical batch compiler. In the system, error recovery is important and often requires lookahead and backtracking. Today, many such systems are being rewritten to use the advances made with multi-core processors. However, these parsing systems use destructive updates to their internal data structures and therefore are not suitable to multithreaded use. Employing an immutable system, the compiler can spread work across multiple threads in a safe manner.
-
FIG. 2 illustrates an exemplaryimmutable parser configuration 115 in accordance with an aspect of the claimed subject matter. As shown, theconfiguration 115 includes animmutable buffer 210 and an immutable stack 220 (both of which can be components as defined herein). In essence, theparser configuration 115 is an amalgamation of thebuffer 210 and thestack 220 and is therefore immutable by construction. - The
immutable buffer 210 also referred to as an input buffer or lookahead buffer provides a sequence of characters or the like for parsing. In accordance with one embodiment, theimmutable buffer 210 can save buffer history to enable backtracking, for example. In particular, theimmutable buffer component 210 can remember referenced history and remove or otherwise make referenced history available for garbage collection. Furthermore, according to an aspect, thebuffer 210 can appear to be modified by appending new input states to the front of the immutable structure thereby allowing the future to be changed. - The
immutable stack 220 records parsing history. It is employed to facilitate identification of tokens and expressions, among other things. In accordance with one embodiment, the immutable stack can be nondeterministic, where stack items can point to “n” items rather than simply one item, although that is also possible. In other words, thestack 220 can be a special cactus stack. In accordance with one implementation, the stack can be a rooted, directed, acyclic graph with a single sink node. This enables the parser to hold onto multiple pasts similar to theimmutable buffer 210. Further yet, in accordance with an aspect, thestack 220 can appear to change by appending states to the end of the stack. - What follows is exemplary code to facilitate description of one possible implementation. Of course, the subject claims are not limited thereto. Many other implementations are also possible and intended to be with in the scope of the claimed subject matter. The sole purpose of the below code and explanation is to aid clarity and understanding not to limit implementations or equivalents.
- The
immutable parser configuration 115 can have the following interface: -
public class ParserConfiguration<TStack, TInput> { public ParserConfiguration(TStack stack, TInput input); public TInput Input { get; } public TStack Stack { get; } } - As specified, there is no way to change the configuration after it has been constructed. One can “get” the input buffer and stack, but cannot change or “set” it. As a result, the parser configuration is immutable.
- “TInput” can be implemented by a type such as the following:
-
public interface IChain<T> : IEnumerable<T> { T Value { get; } IChain<T> Next { get; } IEnumerable<T> GetValuesUntil(IChain<T> exclusiveSentinel); } - In this case, there is an “IChain” that is a linked list comprising a value and a next that may or may not be materialized (lazy computation is possible). The “IChain” is implemented with an “IEnumerable,” which defers computation until iteration is performed over a collection. In operation, a lexer can return an “IEnumerable” of tokens from an input source. That means that it does not actually lex out the tokens until each token is called. Here, an “IChain” is constructed out of an “IEnumerable” so that elements can be iterated through, but while also saving the history that has already been enumerated. In other words, “IEnumerable” only allows forward iteration, whereas “IChain” also allows backward iteration through previously iterated values.
- “IStack” can be implemented by a type as follows:
-
public interface IStackLink<A> { A Value { get; set; } StateStack<A> Stack { get; } } public class StateStack<A> : IStackLink<A> { public StateStack(short state); public StateStack(StateStack<A> previous, short state, A value); public int DeterministicDepth { get; } public bool IsBottom { get; } public bool IsDeterministic { get; } public IEnumerable<IStackLink<A>> Links { get; } public StateStack<A> Stack { get; } public short State { get; } public A Value { get; set; } public void AddLink(IStackLink<A> link); public void InvalidateDeterministicDepth( ); public StateStack<A> Pop( ); public override string ToString( ); } - The
immutable stack 220 can be implemented as an “IStackLink” providing a linked list of state stacks (“StateStack”). The state stacks are implemented as nondeterministic. Accordingly, a stack element can refer to more than one other element in a modified cactus form. - In sum, the
parser configuration 115 is composed of animmutable input buffer 210 and immutable,nondeterministic state stack 220. Moreover, these two structures can be employed to represent a parser configuration at any point in time during a parse. - Turning attention to
FIG. 3 , aversion system 300 is illustrated in accordance with an aspect of the claimed subject matter. Where immutable structures are employed, there is a potential to utilize large amounts of memory to hold various versions. For example, a new version of an immutable stack is generated with each push or pop operation (or equivalent). Accordingly,version system 300 can be employed by one or more parse system components such aslexical analyzer 110 andsyntactic analyzer 120. As shown, thesystem 300 includes a sharedelement component 210 and astructure generation component 320. - The shared
element component 310 identifies elements that are common to a first version and a yet to be produced second version. The communicatively coupledstructure generation component 320 produces a new structure adding new elements and/or removing old elements, wherein shared elements need not be constructed but rather simply referenced or linked. However, in some instances parent elements can be rewritten. This significantly reduces resource utilization associated with producing multiple copies of immutable structures. - Turning to
FIGS. 4 a-d, iterations of exemplary lexical analysis is illustrated utilizing immutable structures to facilitate clarity and understanding with respect to aspects of the claimed subject matter. In each case, there are one or more immutable stacks (e.g., stack configuration) and one or more immutable buffers (e.g., buffer configuration). While the buffers are populated with data in these examples, it is to be noted that such data can be realized lazily as needed. Referring first toFIG. 4 a, a single stack “stake 0” 410 is depicted as well as an input buffer “buffer 0” 420. Thestack 410 includes one element “a,” which is identified by a pointer into theinput buffer 420.FIG. 4 b shows a stack configuration including two stacks or versions “stack 0” 410 and “stack 1” 412, where the latter references or links to the former. A new pointer is also generated identifying the second element in theinput buffer 420 pointing to “b” that is embodied in “stack 1” 412. Similarly,FIG. 4 c adds another immutable stack or version “stack 2” 414 to the set of stacks linked to the pervious stack “stack 1” 412 in accordance with generation of a new pointer that points to character “c” captured “stack 2” 414.FIG. 4 d illustrates yet another element that begets construction of a new stack “stack 3” 416 including the element “d” that is linked to “stack 2” 414 Moreover, another immutable buffer “buffer 1” 422 is created and linked to the previous buffer “buffer 0” 420 since the later had been processed. A new pointer is create and points to “d” which is added by generation of a new immutable stack “stack 3” 416 linked to the previous stack “stack 2” 414. -
FIGS. 5 a-b illustrate further examples of interaction with immutable structures, namely immutable stacks to aid clarity and understanding with respect to aspects of the claimed subject matter. As shown inFIG. 5 a, animmutable stack configuration 500 is shown where first “a” is pushed forming “stack 0”, then on that initial stack both “d” (“stack 1), and “b” (“stack 2”) then “c” (“stack 3”) are pushed. Rather than pointing to solely one item, here thestack configuration 500 provides an example of a cactus stack where both “stack 1” and “stack 2” point to “stack 0.” Where nodes “b” and “c” are subsequently removedstack configuration 510 results, including “stack 0” and “stack 1.” Furthermore, it is to be appreciated that where nodes “a,” “b,” and “c” are deleted,configuration 510 will still result since there is a copy of node “a” that corresponds to “b” and “c” and a copy that corresponds to “d.” -
FIG. 6 depicts anerror recovery system 600 in accordance with an aspect of the claimed subject matter. Thesystem 600 includes anerror detection component 610 that identifies an error in a parsing process. Where the parser operates in the contexts of an IDE, errors are more a norm than an exception, since the parser is often operating over an incomplete program. However, errors are typically present with regularity complete programs and batch compilers as well. Upon identification of an error, communicatively coupledrecovery component 620 can resolve the error to allow parsing to continue, for example. - In accordance with one embodiment, the
recovery component 620 can seek assistance from other methods, functions, services and/or the like. In particular, therecovery component 620 includes aninterface component 622 that can communicate with anexternal recovery component 630. For example, theinterface component 622 can provide the parser configuration at the time of the error to the externalerror recovery system 630. Theexternal recovery component 630 can subsequently determine a cause of the error and a strategy for recovering which can be communicated back to therecovery component 620 by way ofinterface component 622. For example, the strategy can identify changes that should be made to the configuration.Execution component 624 can execute or implement an identified strategy. For instance, theexecution component 624 can generate a new immutable parser configuration to replace the old configuration. - It is to be appreciated that the
error recovery system 600 operates in a safe manner. In one instance, since the configuration is immutable, it is safe for a parsing system to provide this information to another process without fear that the process will compromise the system. Safety is further added by reserving changes for solely the parsing system and seeking recovery strategies or recommendations, as opposed to allowing another method, process, service or the like to generate a new immutable type. -
FIG. 7 is a block diagram of anambiguity resolution system 700 in accordance with an aspect of the claimed subject matter. Unlike errors in which no path is available for further processing, ambiguities or conflicts exist when there is more than one way to continue parsing.Conflict detection component 710 identifies such conflicts or ambiguities during parsing.Conflict resolution component 720 is a mechanism for resolving conflicts. While theconflict resolution component 720 can handle such resolution internally, it is also able to seek external assistance. To that end, theresolution component 720 includes aninterface component 722 that interacts with an externalconflict resolution component 730. The external conflict resolution component can comprise a different method, function, process server or the like than that employed by a parser. More particularly, theinterface component 722 can transmit the current immutable parser configuration to theresolution component 730. From the configuration, various functions and/or analysis are performed to determine how to resolve the conflict. In one embodiment, recovery strategies can be associated with particular parser configurations. Accordingly, the external resolution component need only match the current configuration to configuration associated with a strategy that identifies how to resolve the conflict. In any event, the identified strategy can be passed back toresolution component 720 by way ofinterface 722. Subsequently,execution component 724 can execute or implement the conflict resolution strategy. For example, the current parser configuration can be altered. - Note that
ambiguity resolution system 700 is analogous to theerror recovery system 600. Accordingly, the same safety benefits are afforded. In brief, safety is ensured by passing an immutable parser state and accepting resolution or recovery strategies as suggestions rather than allowing an external process or the like to directly alter parser state with respect to mutable and/or immutable structures. - Referring to
FIG. 8 ,system 800 that effects change to immutable structures in an incremental parsing scenario is illustrated. The system includes achange detection component 810 that identifies changes or desired changes. For example, consider parsing in an IDE context. Upon text edit (e.g., addition, removal, alteration), an immutable parse tree should be altered to reflect changes. More specifically, a new token stream is generated from which a new parse tree is constructed. The changeddetection component 810 can identify such changes in text and initiate execution of tokenstream modification component 820. - The token
stream modification component 820 determines which tokens are affected by an identified modification and accordingly need to be reprocessed. Given a start and end position of an edit, the tokenstream modification component 820 determines the first and last tokens this edit touches (including right at the edge). In accordance with one exemplary implementation, if the edit intersects tokens then it appends the parts of tokens not touched by the edit. This aligns everything and makes processing much easier since intra-token edits need not be handled. Now, thecomponent 820 can determine text to scan or lex. This is based on the tokens to be rescanned as well as any new text. The scanning should not stop until all of the tokens in a look-back set of the first affected token, all of the contents of newly improved text change, and the last affected token are processed. As a result, the tokenstream modification component 820 produces is a new immutable token stream that can share as many tokens with the previous token stream as possible. - Parse
tree modification component 830 utilizes the new immutable token stream to produce a new immutable parse tree that similarly shares as much as possible from the previous tree. In particular, nodes can be generated for each newly added token or syntactic expression. Further, explicitly or implicitly data shared with a previous immutable tree is linked. Still further yet, parents of newly added children can be rewritten. -
FIG. 9 depicts graphically modification of an exemplary immutable parse tree to facilitate clarity with respect to aspects of the claimed subject matter. Original parsetree 910 includes root node “a” 911 with children “b” 912 and “c” 913. The node “c” 913 also has two children “d” 914 and “e” 915. Theoriginal tree 910 is to be modified to include node a new node “g” as a child of node “b” 912. This provides new “modified”tree 920. As shown, the modifiedtree 920 includes rewritten root “a′” 921 and child “b” 922 as well as the new node “g” 923. The modifiedtree 920 need not include node “c” 913 and its children since it can be shared between versions and/or lazily computed to enable efficient memory utilization, among other things. - From the illustrations of
original tree 910 and modifiedtree 920, the significance of immutability can be appreciated. In particular, it is important that trees be immutable where sub-trees are shared. If the sub-tree could be modified, the invariance of the modifiedtree 920 would be negatively impacted, because it is assumed that only new parts of things that are modified are built. Accordingly, it is desirable to ensure that no one can modified the sub-tree “c” 913 with child nodes “d” 914 and “e” 915. - Referring to
FIG. 10 a, alazy computation system 1000 is illustrated in accordance with an aspect of the claimed subject matter. Immutable structures enable lazy computation. If things are immutable, they can be removed and subsequently reconstructed. In other words, since things are not changing whether or not they are in memory does not matter, because they can be reconstructed given that they are going to be the same. Thesystem 1000 includesrequest interface component 1010 andconstitution component 1020. Therequest interface component 1010 receives or retrieves a request for data. Theconstitution component 1020 returns the requested data to theinterface component 1010. Where the data is not constituted or realized, it can be constituted or reconstituted. In other words, the data can be computed and saved in memory as needed in response to requests. -
FIG. 10 b depicts a partially constituted parsetree 1050 in accordance with an aspect of the claimed subject matter. Thetree 1050 includes constituted or root node “A” 1060 with children “B” 1072 and “C” 1074. The node “B” 1072 also includes two children “D” 1082 and “E” 1084. The node “C” 1074 has two children “F” 1086 and “G” 1088. The root node “A” 1060 and the sub-tree associated with node “B” 1072 are both constituted where as the sub-tree associated with node “C” 1074 is not realized. Accordingly, where a request concerns node “C” 1074, “F” 1086, and/or G”1088, such data will need to be constituted or computed. -
FIG. 11 illustrates a parse-tree interaction system 1100 in accordance with an aspect of the claimed subject matter. Thesystem 1100 includes aninterface component 1110 including one ormore services 1112 communicatively coupled to an immutable parsetree 1120. In accordance with one embodiment,interface component 1110 can be implemented in a wrapper design pattern around the immutable parsetree 1120. Additionally or alternatively, theinterface component 1110 can be embodied as a view tree. In any event, theservices 1112 acquire or compute information from theimmutable tree 120 and provide such information back to a requesting entity. - By way of example and not limitation, one or
more services 1112 can pertain to identifying parents and/or children in a version of theimmutable tree 1120. In one instance, an immutable tree can be built from the bottom up. Since children are constructed prior to parents, parents are unknown at the time of child production. Consequently, a node cannot simply be asked to return its parent, because it was not encoded with that information unless of course a parent and child are created at the same time, which most programming languages do not allow. Accordingly, aservice 1112 can compute a parent or parents for an identified node by way of analysis of tree structure. In one instance, parents can be lazily computed. However, computation of parents may involve computation of other parents thereby amortizing computational cost. - Immutability allows for safe sharing and duplication, among other things. Accordingly, parallelism and distribution are enabled. In particular, a copy cannot be differentiated from an original, which is okay, because they are not going to change anyway. For example, in context of parsing and an IDE code analysis may be desired, which can be potentially expensive. Immutable trees are useful here for at least two reasons. First, a copy of a parse tree can provided without having to worry about unexpected and/or undesirable changes. Second, the copy can be duplicated to allow parallel analysis. For instance, portions of a conditional statement can be analyzed concurrently. Furthermore, it should be noted that an “undo” operation in an IDE becomes trivial rather than very complex. In essence, “undo” simply involves referencing a different parser configuration, for example.
- The aforementioned systems, architectures, and the like have been described with respect to interaction between several components. It should be appreciated that such systems and components can include those components or sub-components specified therein, some of the specified components or sub-components, and/or additional components. Sub-components could also be implemented as components communicatively coupled to other components rather than included within parent components. Further yet, one or more components and/or sub-components may be combined into a single component to provide aggregate functionality. For example, a parser can include separate components for lexical and syntactic analysis or a single component that performs both functions. Communication between systems, components and/or sub-components can be accomplished in accordance with either a push and/or pull model. The components may also interact with one or more other components not specifically described herein for the sake of brevity, but known by those of skill in the art.
- Furthermore, as will be appreciated, various portions of the disclosed systems above and methods below can include or consist of artificial intelligence, machine learning, or knowledge or rule based components, sub-components, processes, means, methodologies, or mechanisms (e.g., support vector machines, neural networks, expert systems, Bayesian belief networks, fuzzy logic, data fusion engines, classifiers . . . ). Such components, inter alia, can automate certain mechanisms or processes performed thereby to make portions of the systems and methods more adaptive as well as efficient and intelligent. By way of example and not limitation, such mechanisms can be utilized to facilitate predictive computation and caching of portions of lazily computed structures to enable efficient processing. For instance, inferences can be made regarding a parse tree and contextual information that suggest that particular portions are likely to be needed soon.
- In view of the exemplary systems described supra, methodologies that may be implemented in accordance with the disclosed subject matter will be better appreciated with reference to the flow charts of
FIGS. 12-15 . While for purposes of simplicity of explanation, the methodologies are shown and described as a series of blocks, it is to be understood and appreciated that the claimed subject matter is not limited by the order of the blocks, as some blocks may occur in different orders and/or concurrently with other blocks from what is depicted and described herein. Moreover, not all illustrated blocks may be required to implement the methodologies described hereinafter. - Referring to
FIG. 12 , a method of parsing 1200 is illustrated in accordance with an aspect of the claimed subject matter. Atreference numeral 1210, an initial immutable configuration including an immutable input buffer and stack are instantiated. At numeral 1220, a parsing operation is performed. For example, an identified element in the input buffer is analyzed in an attempt to produce a language valid token. Atreference 1230, a new immutable configuration, namely a buffer and/or state is generated as needed. For instance, where an element is added to the stack or removed from the stack, a new immutable stack is generated to capture the change. Of course, the new stack can share common elements with the previous stack rather than include all elements in the new stack. Atreference 1240, a determination is made as to whether parsing is finished. For instance, it can be determined whether or not an input stream has been completely consumed. If parsing is finished (“YES”), the method simply terminates. Alternatively (“NO”), the method continues at numeral 1220 where another parse operation is performed. -
FIG. 13 depicts amethod 1300 of error recover/conflict resolution in accordance with an aspect of the claimed subject matter. At numeral 1310, an error or ambiguity is detected during parsing. An error is present when there is no path to continue parsing, whereas an ambiguity exists when there is more than one valid path. At numeral 1320, a parser configuration is passed to a recovery/resolution service, process, method or the like. In response, a recover/resolution strategy is acquired atreference 1330. For example, such strategy can identify changes to the parser configuration. At numeral 1340, a new parser configuration is generated in accordance with the strategy to recover from error or resolve a conflict or ambiguity. In this manner, the parser configuration is unable to be modified by a called service or the like since it passes an immutable copy and returns a strategy or recommendation regarding how to proceed rather than effecting the strategy. -
FIG. 14 illustrates an optimalincremental parsing method 1400 in accordance with an aspect of the claimed subject matter. Atreference numeral 1410, an edit is detected to a stream of characters as a result of modifications made to a program in an editor during development, for example. At numeral 1420, tokens affected by the modification such as the first and last tokens are identified. A new immutable data structure that captures the token stream can be generated at reference 1630. Generation can comprise scanning or lexing additional text and affected tokens to synchronize parsing state with an editor state, for instance. - Moreover, the newly generated structure(s) can maximally share as many tokens as possible with the previous structure(s). This makes the method 1600 and data structures “O(t)” in time and space, where “t” is the number of tokens affected. For example, the sequence of tokens preceding the first changed token, and the sequence of tokens after the last changed tokens, can be shared with “O(1)” time/space for the new token stream. In one particular embodiment, the method 1600 can be used with a “history service,” as found in an IDE, for instance. Accordingly, the method 1600 is suitable for rich code (or text) editors that allow storing a history of all versions and edits, with very little time/space overhead. Further yet, the method 1600 is also suited for a heavily threaded environment.
- At
reference numeral 1440, a new immutable parse tree can be constructed from the token stream. Similarly, the new parse tree can share nodes with the previous version and/or be subject to lazy computation. For example, where a single node is added to a sub-tree, only that sub-tree needs to be saved or materialized. Other sub-trees can be shared or later computed lazily on an as needed basis. -
FIG. 15 is a flow chart diagram of a method of interaction with animmutable structure 1500 according to a claimed aspect. Atreference numeral 1510, a request is received with respect to an immutable structure such as a parse tree. At numeral 1520, the structure is interacted with to determine a response to the request, and the response is returned to a requesting entity atreference 1530. For example,method 1500 can be embodied as an interface, wrapper, or view of an immutable tree structure. In one instance, themethod 1500 can operate with respect to a single version of an immutable structure. Additionally or alternatively, themethod 1500 can operate across multiple versions. - The term “parsing” or various forms thereof (e.g., parse, parser, parsed, parses . . . ) is intended to refer to a process associated with lexical and/or syntactic analysis, unless otherwise explicitly noted. Accordingly, where used “parser” can encompass and/or refer to a conventional parser comprising complete lexical and syntactic analysis or a sub-component thereof such as a scanner, lexer, tokenizer, or the like. For example, a lexer can be viewed as a very simple parser.
- The word “exemplary” or various forms thereof are used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects or designs. Furthermore, examples are provided solely for purposes of clarity and understanding and are not meant to limit or restrict the claimed subject matter or relevant portions of this disclosure in any manner. It is to be appreciated that a myriad of additional or alternate examples of varying scope could have been presented, but have been omitted for purposes of brevity.
- As used herein, the term “inference” or “infer” refers generally to the process of reasoning about or inferring states of the system, environment, and/or user from a set of observations as captured via events and/or data. Inference can be employed to identify a specific context or action, or can generate a probability distribution over states, for example. The inference can be probabilistic—that is, the computation of a probability distribution over states of interest based on a consideration of data and events. Inference can also refer to techniques employed for composing higher-level events from a set of events and/or data. Such inference results in the construction of new events or actions from a set of observed events and/or stored event data, whether or not the events are correlated in close temporal proximity, and whether the events and data come from one or several event and data sources. Various classification schemes and/or systems (e.g., support vector machines, neural networks, expert systems, Bayesian belief networks, fuzzy logic, data fusion engines . . . ) can be employed in connection with performing automatic and/or inferred action in connection with the subject innovation.
- Furthermore, all or portions of the subject innovation may be implemented as a method, apparatus or article of manufacture using standard programming and/or engineering techniques to produce software, firmware, hardware, or any combination thereof to control a computer to implement the disclosed innovation. The term “article of manufacture” as used herein is intended to encompass a computer program accessible from any computer-readable device or media. For example, computer readable media can include but are not limited to storage devices such as magnetic devices (e.g., hard disk, floppy disk, magnetic strips . . . ), optical disks (e.g., compact disk (CD), digital versatile disk (DVD) . . . ), smart cards, and flash memory devices (e.g., card, stick, key drive . . . ). Additionally it should be appreciated that a carrier wave can be employed to carry computer-readable electronic data such as those used in transmitting and receiving electronic mail or in accessing a network such as the Internet or a local area network (LAN). Of course, those skilled in the art will recognize many modifications may be made to this configuration without departing from the scope or spirit of the claimed subject matter.
- In order to provide a context for the various aspects of the disclosed subject matter,
FIGS. 16 and 17 as well as the following discussion are intended to provide a brief, general description of a suitable environment in which the various aspects of the disclosed subject matter may be implemented. While the subject matter has been described above in the general context of computer-executable instructions of a program that runs on one or more computers, those skilled in the art will recognize that the subject innovation also may be implemented in combination with other program modules. Generally, program modules include routines, programs, components, data structures, etc. that perform particular tasks and/or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the systems/methods may be practiced with other computer system configurations, including single-processor, multiprocessor or multi-core processor computer systems, mini-computing devices, mainframe computers, as well as personal computers, hand-held computing devices (e.g., personal digital assistant (PDA), phone, watch . . . ), microprocessor-based or programmable consumer or industrial electronics, and the like. The illustrated aspects may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. However, some, if not all aspects of the claimed subject matter can be practiced on stand-alone computers. In a distributed computing environment, program modules may be located in both local and remote memory storage devices. - With reference to
FIG. 16 , anexemplary environment 1610 for implementing various aspects disclosed herein includes a computer 1612 (e.g., desktop, laptop, server, hand held, programmable consumer or industrial electronics . . . ). Thecomputer 1612 includes aprocessing unit 1614, asystem memory 1616, and asystem bus 1618. Thesystem bus 1618 couples system components including, but not limited to, thesystem memory 1616 to theprocessing unit 1614. Theprocessing unit 1614 can be any of various available microprocessors. It is to be appreciated that dual microprocessors, multi-core and other multiprocessor architectures can be employed as theprocessing unit 1614. - The
system memory 1616 includes volatile and nonvolatile memory. The basic input/output system (BIOS), containing the basic routines to transfer information between elements within thecomputer 1612, such as during start-up, is stored in nonvolatile memory. By way of illustration, and not limitation, nonvolatile memory can include read only memory (ROM). Volatile memory includes random access memory (RAM), which can act as external cache memory to facilitate processing. -
Computer 1612 also includes removable/non-removable, volatile/nonvolatile computer storage media.FIG. 16 illustrates, for example,mass storage 1624.Mass storage 1624 includes, but is not limited to, devices like a magnetic or optical disk drive, floppy disk drive, flash memory, or memory stick. In addition,mass storage 1624 can include storage media separately or in combination with other storage media. -
FIG. 16 provides software application(s) 1628 that act as an intermediary between users and/or other computers and the basic computer resources described insuitable operating environment 1610. Such software application(s) 1628 include one or both of system and application software. System software can include an operating system, which can be stored onmass storage 1624, that acts to control and allocate resources of thecomputer system 1612. Application software takes advantage of the management of resources by system software through program modules and data stored on either or both ofsystem memory 1616 andmass storage 1624. - The
computer 1612 also includes one ormore interface components 1626 that are communicatively coupled to thebus 1618 and facilitate interaction with thecomputer 1612. By way of example, theinterface component 1626 can be a port (e.g., serial, parallel, PCMCIA, USB, FireWire . . . ) or an interface card (e.g., sound, video, network . . . ) or the like. Theinterface component 1626 can receive input and provide output (wired or wirelessly). For instance, input can be received from devices including but not limited to, a pointing device such as a mouse, trackball, stylus, touch pad, keyboard, microphone, joystick, game pad, satellite dish, scanner, camera, other computer, and the like. Output can also be supplied by thecomputer 1612 to output device(s) viainterface component 1626. Output devices can include displays (e.g., CRT, LCD, plasma . . . ), speakers, printers, and other computers, among other things. -
FIG. 17 is a schematic block diagram of a sample-computing environment 1700 with which the subject innovation can interact. Thesystem 1700 includes one or more client(s) 1710. The client(s) 1710 can be hardware and/or software (e.g., threads, processes, computing devices). Thesystem 1700 also includes one or more server(s) 1730. Thus,system 1700 can correspond to a two-tier client server model or a multi-tier model (e.g., client, middle tier server, data server), amongst other models. The server(s) 1730 can also be hardware and/or software (e.g., threads, processes, computing devices). Theservers 1730 can house threads to perform transformations by employing the aspects of the subject innovation, for example. One possible communication between aclient 1710 and aserver 1730 may be in the form of a data packet transmitted between two or more computer processes. - The
system 1700 includes acommunication framework 1750 that can be employed to facilitate communications between the client(s) 1710 and the server(s) 1730. The client(s) 1710 are operatively connected to one or more client data store(s) 1760 that can be employed to store information local to the client(s) 1710. Similarly, the server(s) 1730 are operatively connected to one or more server data store(s) 1740 that can be employed to store information local to theservers 1730. - Client/server interactions can be utilized with respect with respect to various aspects of the claimed subject matter. By way of example and not limitation, one or more of the components and/or systems can be embodied as a network or web services provided by one or
more servers 1730 to one ormore clients 1710 across thecommunication framework 1750. In one specific instance, a parser system can transmit an immutable parser configuration across thecommunication framework 1750 to server based error-recovery or conflict-resolution service, which determines a strategy and passes it back to the parser system for implementation. - What has been described above includes examples of aspects of the claimed subject matter. It is, of course, not possible to describe every conceivable combination of components or methodologies for purposes of describing the claimed subject matter, but one of ordinary skill in the art may recognize that many further combinations and permutations of the disclosed subject matter are possible. Accordingly, the disclosed subject matter is intended to embrace all such alterations, modifications, and variations that fall within the spirit and scope of the appended claims. Furthermore, to the extent that the terms “includes,” “contains,” “has,” “having” or variations in form thereof are used in either the detailed description or the claims, such terms are intended to be inclusive in a manner similar to the term “comprising” as “comprising” is interpreted when employed as a transitional word in a claim.
Claims (20)
1. A parsing method, comprising:
employing at least one processor configured to execute computer-executable instructions stored in memory to perform the following act:
parsing an input stream with at least one of an immutable stack or immutable lookahead buffer.
2. The method of claim 1 further comprises producing an immutable parse tree as a function of the parsing.
3. The method of claim 2 further comprises producing multiple versions of the parse tree that share common portions.
4. The method of claim 1 further comprises deferring producing at least a portion of a parse tree from input elements of the lookahead buffer until the at least a portion of the parse tree is needed for a computation.
5. The method of claim 1 further comprises detecting a conflict during parsing and passing a current parser configuration including the stack and the lookahead buffer to a method that identifies a conflict resolution strategy based on the configuration.
6. The method of claim 1 further comprises detecting a parsing error and passing a current parser configuration including the stack and lookahead buffer to a method that affords an error recovery strategy as a function of the configuration.
7. The method of claim 1 further comprises dividing execution of parsing across multiple threads of execution with multiple copies of a configuration including the stack and lookahead buffer.
8. The method of claim 1 further comprises producing a version of the stack or lookahead buffer that shares common unchanged elements.
9. The method of claim 1 further comprises:
detecting a change in the input stream; and
producing a new immutable token stream that shares tokens in common with a previous stream of tokens.
10. A parser system, comprising:
a processor coupled to a memory, the processor configured to execute the following computer-executable components stored in the memory:
a first component configured to perform lexical analysis of an input sequence to produce a sequence of tokens; and
a second component configured to perform syntactic analysis on a sequence of tokens produced from an input sequence to determine a grammatical structure, at least one of the first and second components employ a parser configuration including a stack and buffer, at least one of the stack or the buffer is immutable.
11. The system of claim 10 , the second component produces an immutable parse tree.
12. The system of claim 10 , the second component generates multiple versions of a parse tree that share common portions.
13. The system of claim 10 further comprising a third component configured to provide one or more services to respond to one or more inquiries regarding a parse tree.
14. The system of claim 13 , at least one of the one or more services defers constructing a parse tree, or portion thereof, until needed to respond to at least one of the one or more inquiries.
15. The system of claim 10 further comprises a third component configured to pass the parser configuration to a fourth component configured to perform conflict resolution based on the parser configuration.
16. The system of claim 10 further comprising a third component configured to provide the parser configuration to a fourth component configured to perform error recovery based on the parser configuration.
17. The system of claim 10 , the first component and the second component execute in parallel with immutable parser configurations including an immutable stack and buffer.
18. A computer-readable storage medium having stored thereon instructions that when executed perform a method, the method comprising:
parsing an input stream with at least one of an immutable stack or immutable lookahead buffer.
19. The computer-readable storage medium of claim 18 , the method further comprises producing an immutable parse tree as a function of the parsing.
20. The computer-readable storage medium of claim 19 , the method further comprises producing multiple versions of the parse tree that share common portions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US14/294,107 US20140289715A1 (en) | 2008-08-07 | 2014-06-02 | Immutable parsing |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US12/187,753 US8762969B2 (en) | 2008-08-07 | 2008-08-07 | Immutable parsing |
US14/294,107 US20140289715A1 (en) | 2008-08-07 | 2014-06-02 | Immutable parsing |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US12/187,753 Continuation US8762969B2 (en) | 2008-08-07 | 2008-08-07 | Immutable parsing |
Publications (1)
Publication Number | Publication Date |
---|---|
US20140289715A1 true US20140289715A1 (en) | 2014-09-25 |
Family
ID=41654107
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US12/187,753 Active 2031-03-14 US8762969B2 (en) | 2008-08-07 | 2008-08-07 | Immutable parsing |
US14/294,107 Abandoned US20140289715A1 (en) | 2008-08-07 | 2014-06-02 | Immutable parsing |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US12/187,753 Active 2031-03-14 US8762969B2 (en) | 2008-08-07 | 2008-08-07 | Immutable parsing |
Country Status (1)
Country | Link |
---|---|
US (2) | US8762969B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10277561B2 (en) | 2016-07-22 | 2019-04-30 | International Business Machines Corporation | Database management system shared ledger support |
US10402499B2 (en) * | 2016-11-17 | 2019-09-03 | Goldman Sachs & Co. LLC | System and method for coupled detection of syntax and semantics for natural language understanding and generation |
Families Citing this family (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7877681B2 (en) * | 2002-12-05 | 2011-01-25 | Borland Software Corporation | Automatic context management for web applications with client side code execution |
KR20080045545A (en) * | 2006-11-20 | 2008-05-23 | 삼성전자주식회사 | Method of pre-processing conditional region |
JP2009129127A (en) * | 2007-11-22 | 2009-06-11 | Fujitsu Ltd | Invariable object extraction processing program for program, processor, processing method, and storage medium for storing program |
US8762969B2 (en) * | 2008-08-07 | 2014-06-24 | Microsoft Corporation | Immutable parsing |
US9098269B2 (en) | 2013-01-04 | 2015-08-04 | Microsoft Technology Licensing, Llc | System and method to ensure resource access safety with immutable object types |
US9229959B2 (en) | 2013-01-04 | 2016-01-05 | Microsoft Technology Licensing, Llc | Object graph partial immutability and isolation enforcement |
CN103645931B (en) * | 2013-12-25 | 2016-06-22 | 盛杰 | The method of code conversion and device |
US20150293752A1 (en) * | 2014-04-11 | 2015-10-15 | Pradeep Varma | Unrestricted, Fully-Source-Preserving, Concurrent, Wait-Free, Synchronization-Free, Fully-Error-Handling Frontend With Inline Schedule Of Tasks And Constant-Space Buffers |
US9535664B1 (en) | 2014-04-23 | 2017-01-03 | William Knight Foster | Computerized software development process and management environment |
US11294665B1 (en) | 2014-04-23 | 2022-04-05 | William Knight Foster | Computerized software version control with a software database and a human database |
US20180039399A1 (en) * | 2014-12-29 | 2018-02-08 | Palantir Technologies Inc. | Interactive user interface for dynamically updating data and data analysis and query processing |
US9335911B1 (en) | 2014-12-29 | 2016-05-10 | Palantir Technologies Inc. | Interactive user interface for dynamic data analysis exploration and query processing |
US9715375B1 (en) * | 2016-01-27 | 2017-07-25 | International Business Machines Corporation | Parallel compilation of software application |
US10360301B2 (en) * | 2016-10-10 | 2019-07-23 | International Business Machines Corporation | Personalized approach to handling hypotheticals in text |
EP3340078B1 (en) * | 2016-12-20 | 2022-11-30 | Palantir Technologies Inc. | Interactive user interface for dynamically updating data and data analysis and query processing |
US10885021B1 (en) | 2018-05-02 | 2021-01-05 | Palantir Technologies Inc. | Interactive interpreter and graphical user interface |
US10831456B1 (en) * | 2019-05-31 | 2020-11-10 | The Mathworks, Inc. | External code integrations within a computing environment |
US11392356B1 (en) * | 2021-02-26 | 2022-07-19 | Oracle International Corporation | Online machine learning based compilation |
CN114003231B (en) * | 2021-09-28 | 2022-07-26 | 厦门国际银行股份有限公司 | SQL syntax parse tree optimization method and system |
Citations (47)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4724521A (en) * | 1986-01-14 | 1988-02-09 | Veri-Fone, Inc. | Method for operating a local terminal to execute a downloaded application program |
US5193192A (en) * | 1989-12-29 | 1993-03-09 | Supercomputer Systems Limited Partnership | Vectorized LR parsing of computer programs |
US5339421A (en) * | 1991-03-22 | 1994-08-16 | International Business Machines Corporation | General data stream parser for encoding and decoding data and program interface for same |
US5487147A (en) * | 1991-09-05 | 1996-01-23 | International Business Machines Corporation | Generation of error messages and error recovery for an LL(1) parser |
US5748961A (en) * | 1993-07-12 | 1998-05-05 | Digital Equipment Corporation | Efficient method and apparatus for compiling and linking modules of computer code in a large software system |
US5857212A (en) * | 1995-07-06 | 1999-01-05 | Sun Microsystems, Inc. | System and method for horizontal alignment of tokens in a structural representation program editor |
US5884083A (en) * | 1996-09-20 | 1999-03-16 | Royce; Robert | Computer system to compile non-incremental computer source code to execute within an incremental type computer system |
US5903756A (en) * | 1996-10-11 | 1999-05-11 | Sun Microsystems, Incorporated | Variable lookahead parser generator |
US5963894A (en) * | 1994-06-24 | 1999-10-05 | Microsoft Corporation | Method and system for bootstrapping statistical processing into a rule-based natural language parser |
US5991539A (en) * | 1997-09-08 | 1999-11-23 | Lucent Technologies, Inc. | Use of re-entrant subparsing to facilitate processing of complicated input data |
US6073239A (en) * | 1995-12-28 | 2000-06-06 | In-Defense, Inc. | Method for protecting executable software programs against infection by software viruses |
US6209124B1 (en) * | 1999-08-30 | 2001-03-27 | Touchnet Information Systems, Inc. | Method of markup language accessing of host systems and data using a constructed intermediary |
US20010032281A1 (en) * | 1998-06-30 | 2001-10-18 | Laurent Daynes | Method and apparatus for filtering lock requests |
US20010044811A1 (en) * | 2000-03-09 | 2001-11-22 | Electronic Data Systems Corporation | Method and system for reporting XML data based on precomputed context and a document object model |
US6353925B1 (en) * | 1999-09-22 | 2002-03-05 | Compaq Computer Corporation | System and method for lexing and parsing program annotations |
US20020038453A1 (en) * | 2000-08-09 | 2002-03-28 | Andrew Riddle | Method and system for software optimization |
US6381736B1 (en) * | 1999-10-12 | 2002-04-30 | Cisco Technology, Inc. | Method for compile-time type-checking of arguments for externally-specified format strings |
US20020111951A1 (en) * | 2000-05-18 | 2002-08-15 | Licheng Zeng | Parsing system |
US20030055849A1 (en) * | 1998-12-30 | 2003-03-20 | Etzold Thure | Method and apparatus of processing semistructured textual data into predetermined data structures defined by a structure definition |
US20030106049A1 (en) * | 2001-11-30 | 2003-06-05 | Sun Microsystems, Inc. | Modular parser architecture |
US20030172368A1 (en) * | 2001-12-26 | 2003-09-11 | Elizabeth Alumbaugh | System and method for autonomously generating heterogeneous data source interoperability bridges based on semantic modeling derived from self adapting ontology |
US20040031024A1 (en) * | 2002-02-01 | 2004-02-12 | John Fairweather | System and method for parsing data |
US20040078384A1 (en) * | 2002-01-15 | 2004-04-22 | Keir Robin M. | System and method for network vulnerability detection and reporting |
US6792595B1 (en) * | 1998-12-23 | 2004-09-14 | International Business Machines Corporation | Source editing in a graphical hierarchical environment |
US20050015747A1 (en) * | 2003-07-18 | 2005-01-20 | Bea Systems, Inc. | System and method for performing code completion in an integrated development environment |
US20050114771A1 (en) * | 2003-02-26 | 2005-05-26 | Bea Systems, Inc. | Methods for type-independent source code editing |
US20050216264A1 (en) * | 2002-06-21 | 2005-09-29 | Attwater David J | Speech dialogue systems with repair facility |
US20050273772A1 (en) * | 1999-12-21 | 2005-12-08 | Nicholas Matsakis | Method and apparatus of streaming data transformation using code generator and translator |
US7017175B2 (en) * | 2001-02-02 | 2006-03-21 | Opentv, Inc. | Digital television application protocol for interactive television |
US7039240B2 (en) * | 2002-08-09 | 2006-05-02 | Xerox Corporation | Document image decoding systems and methods using modified stack algorithm |
US20060117307A1 (en) * | 2004-11-24 | 2006-06-01 | Ramot At Tel-Aviv University Ltd. | XML parser |
US20060177061A1 (en) * | 2004-10-25 | 2006-08-10 | Orsini Rick L | Secure data parser method and system |
US7114152B2 (en) * | 2002-01-08 | 2006-09-26 | International Business Machines Corporation | Method, apparatus, and program to determine the mutability of an object at loading time |
US20070011319A1 (en) * | 2002-01-15 | 2007-01-11 | Mcclure Stuart C | System and method for network vulnerability detection and reporting |
US20070118899A1 (en) * | 2002-05-17 | 2007-05-24 | Satyam Computer Services Limited Of Mayfair Centre | System and method for automated safe reprogramming of software radios |
US20070157182A1 (en) * | 2003-07-18 | 2007-07-05 | Bea Systems, Inc. | System and method for performing error recovery in an integrated development environment |
US20070169038A1 (en) * | 2005-12-08 | 2007-07-19 | Intellitactics Inc. | Self learning event parser |
US7289668B2 (en) * | 2002-08-09 | 2007-10-30 | Xerox Corporation | Document image decoding systems and methods using modified stack algorithm |
US20070283441A1 (en) * | 2002-01-15 | 2007-12-06 | Cole David M | System And Method For Network Vulnerability Detection And Reporting |
US20070294682A1 (en) * | 2006-06-20 | 2007-12-20 | Demetriou Christopher G | Systems and methods for caching compute kernels for an application running on a parallel-processing computer system |
US20080075099A1 (en) * | 2001-02-02 | 2008-03-27 | Rachad Alao | Service gateway for interactive television |
US20080281580A1 (en) * | 2007-05-10 | 2008-11-13 | Microsoft Corporation | Dynamic parser |
US20100023798A1 (en) * | 2008-07-25 | 2010-01-28 | Microsoft Corporation | Error recovery and diagnosis for pushdown automata |
US20100024030A1 (en) * | 2008-07-23 | 2010-01-28 | Microsoft Corporation | Restartable transformation automaton |
US20100037212A1 (en) * | 2008-08-07 | 2010-02-11 | Microsoft Corporation | Immutable parsing |
US8087002B2 (en) * | 2006-04-04 | 2011-12-27 | Tibco Software Inc. | Method and system for providing a visual debugger for an interpreted statistical language |
US20130152061A1 (en) * | 2011-12-12 | 2013-06-13 | Microsoft Corporation | Full fidelity parse tree for programming language processing |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3476237B2 (en) * | 1993-12-28 | 2003-12-10 | 富士通株式会社 | Parser |
US6223150B1 (en) * | 1999-01-29 | 2001-04-24 | Sony Corporation | Method and apparatus for parsing in a spoken language translation system |
US6631346B1 (en) * | 1999-04-07 | 2003-10-07 | Matsushita Electric Industrial Co., Ltd. | Method and apparatus for natural language parsing using multiple passes and tags |
US6424982B1 (en) * | 1999-04-09 | 2002-07-23 | Semio Corporation | System and method for parsing a document using one or more break characters |
US20060095900A1 (en) * | 2004-08-26 | 2006-05-04 | Calpont Corporation | Semantic processor for a hardware database management system |
-
2008
- 2008-08-07 US US12/187,753 patent/US8762969B2/en active Active
-
2014
- 2014-06-02 US US14/294,107 patent/US20140289715A1/en not_active Abandoned
Patent Citations (53)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4724521A (en) * | 1986-01-14 | 1988-02-09 | Veri-Fone, Inc. | Method for operating a local terminal to execute a downloaded application program |
US5193192A (en) * | 1989-12-29 | 1993-03-09 | Supercomputer Systems Limited Partnership | Vectorized LR parsing of computer programs |
US5339421A (en) * | 1991-03-22 | 1994-08-16 | International Business Machines Corporation | General data stream parser for encoding and decoding data and program interface for same |
US5487147A (en) * | 1991-09-05 | 1996-01-23 | International Business Machines Corporation | Generation of error messages and error recovery for an LL(1) parser |
US5748961A (en) * | 1993-07-12 | 1998-05-05 | Digital Equipment Corporation | Efficient method and apparatus for compiling and linking modules of computer code in a large software system |
US5963894A (en) * | 1994-06-24 | 1999-10-05 | Microsoft Corporation | Method and system for bootstrapping statistical processing into a rule-based natural language parser |
US5857212A (en) * | 1995-07-06 | 1999-01-05 | Sun Microsystems, Inc. | System and method for horizontal alignment of tokens in a structural representation program editor |
US6073239A (en) * | 1995-12-28 | 2000-06-06 | In-Defense, Inc. | Method for protecting executable software programs against infection by software viruses |
US5884083A (en) * | 1996-09-20 | 1999-03-16 | Royce; Robert | Computer system to compile non-incremental computer source code to execute within an incremental type computer system |
US5903756A (en) * | 1996-10-11 | 1999-05-11 | Sun Microsystems, Incorporated | Variable lookahead parser generator |
US5991539A (en) * | 1997-09-08 | 1999-11-23 | Lucent Technologies, Inc. | Use of re-entrant subparsing to facilitate processing of complicated input data |
US20010032281A1 (en) * | 1998-06-30 | 2001-10-18 | Laurent Daynes | Method and apparatus for filtering lock requests |
US6792595B1 (en) * | 1998-12-23 | 2004-09-14 | International Business Machines Corporation | Source editing in a graphical hierarchical environment |
US20030055849A1 (en) * | 1998-12-30 | 2003-03-20 | Etzold Thure | Method and apparatus of processing semistructured textual data into predetermined data structures defined by a structure definition |
US6209124B1 (en) * | 1999-08-30 | 2001-03-27 | Touchnet Information Systems, Inc. | Method of markup language accessing of host systems and data using a constructed intermediary |
US6353925B1 (en) * | 1999-09-22 | 2002-03-05 | Compaq Computer Corporation | System and method for lexing and parsing program annotations |
US6381736B1 (en) * | 1999-10-12 | 2002-04-30 | Cisco Technology, Inc. | Method for compile-time type-checking of arguments for externally-specified format strings |
US20050273772A1 (en) * | 1999-12-21 | 2005-12-08 | Nicholas Matsakis | Method and apparatus of streaming data transformation using code generator and translator |
US20010044811A1 (en) * | 2000-03-09 | 2001-11-22 | Electronic Data Systems Corporation | Method and system for reporting XML data based on precomputed context and a document object model |
US20020111951A1 (en) * | 2000-05-18 | 2002-08-15 | Licheng Zeng | Parsing system |
US20020038453A1 (en) * | 2000-08-09 | 2002-03-28 | Andrew Riddle | Method and system for software optimization |
US20080075099A1 (en) * | 2001-02-02 | 2008-03-27 | Rachad Alao | Service gateway for interactive television |
US7017175B2 (en) * | 2001-02-02 | 2006-03-21 | Opentv, Inc. | Digital television application protocol for interactive television |
US7089541B2 (en) * | 2001-11-30 | 2006-08-08 | Sun Microsystems, Inc. | Modular parser architecture with mini parsers |
US20030106049A1 (en) * | 2001-11-30 | 2003-06-05 | Sun Microsystems, Inc. | Modular parser architecture |
US20030172368A1 (en) * | 2001-12-26 | 2003-09-11 | Elizabeth Alumbaugh | System and method for autonomously generating heterogeneous data source interoperability bridges based on semantic modeling derived from self adapting ontology |
US7114152B2 (en) * | 2002-01-08 | 2006-09-26 | International Business Machines Corporation | Method, apparatus, and program to determine the mutability of an object at loading time |
US20040078384A1 (en) * | 2002-01-15 | 2004-04-22 | Keir Robin M. | System and method for network vulnerability detection and reporting |
US20070283441A1 (en) * | 2002-01-15 | 2007-12-06 | Cole David M | System And Method For Network Vulnerability Detection And Reporting |
US20070011319A1 (en) * | 2002-01-15 | 2007-01-11 | Mcclure Stuart C | System and method for network vulnerability detection and reporting |
US20040031024A1 (en) * | 2002-02-01 | 2004-02-12 | John Fairweather | System and method for parsing data |
US7210130B2 (en) * | 2002-02-01 | 2007-04-24 | John Fairweather | System and method for parsing data |
US20070118899A1 (en) * | 2002-05-17 | 2007-05-24 | Satyam Computer Services Limited Of Mayfair Centre | System and method for automated safe reprogramming of software radios |
US20050216264A1 (en) * | 2002-06-21 | 2005-09-29 | Attwater David J | Speech dialogue systems with repair facility |
US7039240B2 (en) * | 2002-08-09 | 2006-05-02 | Xerox Corporation | Document image decoding systems and methods using modified stack algorithm |
US7289668B2 (en) * | 2002-08-09 | 2007-10-30 | Xerox Corporation | Document image decoding systems and methods using modified stack algorithm |
US20050114771A1 (en) * | 2003-02-26 | 2005-05-26 | Bea Systems, Inc. | Methods for type-independent source code editing |
US20050015747A1 (en) * | 2003-07-18 | 2005-01-20 | Bea Systems, Inc. | System and method for performing code completion in an integrated development environment |
US20070157182A1 (en) * | 2003-07-18 | 2007-07-05 | Bea Systems, Inc. | System and method for performing error recovery in an integrated development environment |
US7913238B2 (en) * | 2003-07-18 | 2011-03-22 | Oracle International Corporation | System and method for performing error recovery in an integrated development environment |
US20080066062A1 (en) * | 2003-07-18 | 2008-03-13 | Bea Systems, Inc. | System and method for performing code completion with an extensible compiler framework in an integrated development environment |
US20060177061A1 (en) * | 2004-10-25 | 2006-08-10 | Orsini Rick L | Secure data parser method and system |
US20060117307A1 (en) * | 2004-11-24 | 2006-06-01 | Ramot At Tel-Aviv University Ltd. | XML parser |
US20070169038A1 (en) * | 2005-12-08 | 2007-07-19 | Intellitactics Inc. | Self learning event parser |
US7577633B2 (en) * | 2005-12-08 | 2009-08-18 | Intellitactics Inc. | Self learning event parser |
US8087002B2 (en) * | 2006-04-04 | 2011-12-27 | Tibco Software Inc. | Method and system for providing a visual debugger for an interpreted statistical language |
US20070294682A1 (en) * | 2006-06-20 | 2007-12-20 | Demetriou Christopher G | Systems and methods for caching compute kernels for an application running on a parallel-processing computer system |
US20080281580A1 (en) * | 2007-05-10 | 2008-11-13 | Microsoft Corporation | Dynamic parser |
US7962904B2 (en) * | 2007-05-10 | 2011-06-14 | Microsoft Corporation | Dynamic parser |
US20100024030A1 (en) * | 2008-07-23 | 2010-01-28 | Microsoft Corporation | Restartable transformation automaton |
US20100023798A1 (en) * | 2008-07-25 | 2010-01-28 | Microsoft Corporation | Error recovery and diagnosis for pushdown automata |
US20100037212A1 (en) * | 2008-08-07 | 2010-02-11 | Microsoft Corporation | Immutable parsing |
US20130152061A1 (en) * | 2011-12-12 | 2013-06-13 | Microsoft Corporation | Full fidelity parse tree for programming language processing |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10277561B2 (en) | 2016-07-22 | 2019-04-30 | International Business Machines Corporation | Database management system shared ledger support |
US10826878B2 (en) | 2016-07-22 | 2020-11-03 | International Business Machines Corporation | Database management system shared ledger support |
US10402499B2 (en) * | 2016-11-17 | 2019-09-03 | Goldman Sachs & Co. LLC | System and method for coupled detection of syntax and semantics for natural language understanding and generation |
AU2017362314B2 (en) * | 2016-11-17 | 2021-07-08 | Goldman Sachs & Co. LLC | System and method for coupled detection of syntax and semantics for natural language understanding and generation |
US11138389B2 (en) | 2016-11-17 | 2021-10-05 | Goldman Sachs & Co. LLC | System and method for coupled detection of syntax and semantics for natural language understanding and generation |
Also Published As
Publication number | Publication date |
---|---|
US8762969B2 (en) | 2014-06-24 |
US20100037212A1 (en) | 2010-02-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8762969B2 (en) | Immutable parsing | |
Czajka et al. | Hammer for Coq: Automation for dependent type theory | |
US7962904B2 (en) | Dynamic parser | |
Ahmad et al. | Automatically leveraging mapreduce frameworks for data-intensive applications | |
Rompf et al. | Optimizing data structures in high-level programs: New directions for extensible compilers based on staging | |
Odena et al. | Bustle: Bottom-up program synthesis through learning-guided exploration | |
US9170787B2 (en) | Componentization of compiler functionality | |
US20100037213A1 (en) | Grammar-based generation of types and extensions | |
Si et al. | Learning a meta-solver for syntax-guided program synthesis | |
Basin et al. | Almost event-rate independent monitoring of metric dynamic logic | |
US20090328016A1 (en) | Generalized expression trees | |
Barenghi et al. | Parallel parsing made practical | |
JP2009505174A (en) | Lambda expression | |
Mitchell | Shake before building: replacing make with haskell | |
Razavi et al. | Partial evaluation of model transformations | |
Izmaylova et al. | Practical, general parser combinators | |
Zhou et al. | HARP: holistic analysis for refactoring Python-based analytics programs | |
US20100042982A1 (en) | Optimization of imperative implementation of compositional content | |
Prabhu et al. | Memodyn: Exploiting weakly consistent data structures for dynamic parallel memoization | |
Kadosh et al. | PragFormer: Data-driven Parallel Source Code Classification with Transformers | |
Shen et al. | Multigraph learning for parallelism discovery in sequential programs | |
Goyal et al. | A High Performance Computing framework for data mining | |
Stanier | Removing and restoring control flow with the value state dependence graph | |
Wang et al. | Ompparser: A standalone and unified OpenMP parser | |
Yedidia et al. | Fast incremental PEG parsing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
AS | Assignment |
Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:034747/0417 Effective date: 20141014 Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:039025/0454 Effective date: 20141014 |
|
STCB | Information on status: application discontinuation |
Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION |