Incremental Parsing of Context-Sensitive Programming Languages

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current techniques for determining the meaning of entities in complex source code files, especially in context-sensitive programming languages, are inefficient and often provide inaccurate results due to the need for full semantic parsing after every edit, which can be resource-intensive and time-consuming.

Innovation Solution

The proposed solution involves performing a name parse to gather data used during semantic parsing, building a name table and range table, and using an entity candidate recursive semantic parser to determine entity meanings incrementally, deferring full semantic parsing until a request is received, thus reducing resource usage and maintaining consistency without repeated full parses.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If full semantic parsing is performed after every edit to maintain accuracy, then measurement precision is improved, but productivity deteriorates due to resource-intensive repeated parsing

Engineering Contradiction:
Improveentity meaning accuracyVSAvoidparsing efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent segments the source code into discrete entities (functions, classes, variables, etc.) with specific position ranges, and segments the parsing process into incremental updates. Instead of re-parsing the entire codebase, only the affected entity and its dependent entities are re-parsed when edits occur, maintaining accuracy while improving efficiency.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary name parsing to build a database of entity names and their position ranges before semantic parsing. This preliminary action creates a foundation that allows incremental updates - when code is edited, the system can quickly identify affected entities using the pre-built name table rather than re-parsing everything.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If full semantic parsing is performed repeatedly to maintain consistency after edits, then reliability is improved, but loss of time increases due to resource consumption

Engineering Contradiction:
Improveentity meaning consistencyVSAvoidparsing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system dynamically adapts the parsing process based on edit operations. When code is added, removed, or modified, the system dynamically identifies which entities are affected and performs incremental semantic parsing only on those entities, rather than statically re-parsing the entire codebase. This dynamic approach maintains consistency while minimizing time loss.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system uses feedback from edit operations to trigger selective re-parsing. When an edit occurs, the system receives feedback about what changed, uses this feedback to identify affected entities through the name table and range table, and then performs semantic parsing only on those specific entities, maintaining consistency efficiently.

Inventive Principle:
Principle #23Feedback

3Measurement precision

If comprehensive entity tracking is implemented to improve entity meaning determination, then measurement precision is improved, but device complexity increases due to multiple tables and parsing processes

Engineering Contradiction:
Improveentity identification accuracyVSAvoidparsing system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent introduces intermediary data structures (name table, range table, parse tree index) that mediate between the source code and the semantic parsing process. These intermediaries organize entity information in a structured way, making it easier to query and update. The name table maps entity names to positions, the range table maps positions to entities, and the parse tree index connects source code positions to parse tree nodes, simplifying the overall system architecture.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Productivity

If incremental parsing is used to reduce resource usage, then productivity is improved, but measurement precision may deteriorate due to partial parsing

Engineering Contradiction:
Improveparsing efficiencyVSAvoidentity meaning accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The system maintains continuous entity meaning information through incremental updates. When code is edited, the semantic parsing process continues by updating only the affected entities and their dependencies, rather than restarting from scratch. This continuous update approach ensures that entity meanings remain accurate while improving productivity, as the parsing action is ongoing and adaptive rather than intermittent and complete.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS8364696B2Efficient incremental parsing of context sensitive programming languages
Publication Date: 2013.01.29 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8364696B2 patent drawing
  • US8364696B2 patent drawing
  • US8364696B2 patent drawing

AI summary

Many integrated development environments provide “intelligent feedback” to developers. Current “intelligent feedback” techniques may not work well with source code files comprising context sensitive programming languages because edits to one place in the code may change the meaning of arbitrary other places in the code, thus requiring additional full semantic parses to maintain correctness of the system. As provided herein, context-free “name” parsing may be performed to support entity candidate recursive semantic parsing in determining the meaning of the entity. A name parse may be performed to build and/or update a name table and a range table comprising names of entities and their positions within a source code file. Upon receiving a request to determine the meaning of a selected entity within the source code file, the tables may be queried to determine entity names and locations that are to be semantically parsed to determine a selected entity meaning.