Source-to-source transformation for language dialects
First Claim
1. A computer-assisted method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising:
- generating, by a computing device, from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language, said generating said plurality of different intermediate forms comprising;
pre-processing said source code region to create a textual elaborated output;
lexing said textual elaborated output from said preprocessing to create a lexeme stream output;
parsing said lexeme stream output from said lexing to create an abstract syntax tree output; and
type checking said abstract syntax tree output from said parsing to create a typed tree output; and
generating, by said computing device, a multilayered map associated with each of said plurality of different intermediate forms and each map corresponding to said different computer programming language, said multilayered map representing a sequence of pre-processed code ranges that together cover the entirety of said textual elaborated output with at least one notation per layer of said multilayer map designating;
a validly analyzed region;
a valid non-code region;
an invalid skipped region; and
an unknown status region.
1 Assignment
0 Petitions
Accused Products
Abstract
An analysis and source-to-source transformation framework covers dialects of programming languages that lack formal definition for all individual dialects. Multiple instantiations of the same compiler front-end tools can be used with different settings to create distinct intermediate forms and maps. Intermediate forms and maps are used in an individual analysis and source-to-source transformation context, and performing the analysis and source-to-source transformation thereupon. A unified tool set is desirably provided, including standard compiler front-end tools and code transformation/generation tools, wherein source code edits are carried out in order to make the source code more amenable to translation to intermediate forms. The analysis results or intermediate forms created by individual tools are used by other tools as well as further analyzed to create a map of the regions of validity and invalidity of the intermediate forms, and tracking the source-code edits performed in order to obtain the same. Among other benefits, this provides a choice of the best tools combination for maximum code analysis coverage.
-
Citations
14 Claims
-
1. A computer-assisted method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising:
-
generating, by a computing device, from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language, said generating said plurality of different intermediate forms comprising; pre-processing said source code region to create a textual elaborated output; lexing said textual elaborated output from said preprocessing to create a lexeme stream output; parsing said lexeme stream output from said lexing to create an abstract syntax tree output; and type checking said abstract syntax tree output from said parsing to create a typed tree output; and generating, by said computing device, a multilayered map associated with each of said plurality of different intermediate forms and each map corresponding to said different computer programming language, said multilayered map representing a sequence of pre-processed code ranges that together cover the entirety of said textual elaborated output with at least one notation per layer of said multilayer map designating; a validly analyzed region; a valid non-code region; an invalid skipped region; and an unknown status region. - View Dependent Claims (2, 3, 4)
-
-
5. A computer storage medium readable by a computer tangibly embodying a program of instructions executable by said computer for performing a method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising:
-
generating from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language; and generating a map associated with each of said plurality of different intermediate forms, said map representing regions within the associated intermediate form that are valid. - View Dependent Claims (6)
-
-
7. A computer system comprising:
-
a processor for executing software instructions; a memory for storing software instructions; a system bus coupling the memory and the processor; and a storage medium recording software instructions that are loadable to the memory for iteratively interpreting a single source code region written in one computer programming language or as another computer programming language by implementing an initial iteration comprising; generating from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language; and generating a map associated with each of said plurality of different intermediate forms, said map representing regions within the associated intermediate form that are valid. - View Dependent Claims (8)
-
-
9. A computer program product comprising:
-
a storage medium readable by a computer system and tangibly embodying recording software instructions organized as separate software components executable in combination by a computer system, said software instructions being configured to perform a method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising; generating from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language; and generating a map associated with each of said plurality of different intermediate forms, said map representing regions within the associated intermediate form that are valid. - View Dependent Claims (10)
-
-
11. A computer system comprising:
-
a processor for executing software instructions; a memory for storing software instructions; a system bus coupling the memory and the processor; and a computer program product comprising; a storage medium readable by a computer system and recording software instructions organized as separate software components executable in combination by a computer system, said software instructions being configured to perform a method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising; generating from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language; and generating a map associated with each of said plurality of different intermediate forms, said map representing regions within the associated intermediate form that are valid. - View Dependent Claims (12)
-
-
13. A computer-assisted method for iteratively interpreting a single source code region written in one computer programming language as another computer programming language, the method comprising an initial iteration comprising:
-
generating from said single source code region a plurality of different intermediate forms each corresponding to a different computer programming language; generating a map associated with each of said plurality of different intermediate forms, said map representing regions within the associated intermediate form that are valid; analyzing the intermediate forms and associated maps to identify a most suitable intermediate form for said source code region; and transforming the source code region based upon the most suitable intermediate form and associated map. - View Dependent Claims (14)
-
Specification