Download ppt - Computer and Information Sciences

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
A Technique for Constructing
Aspect Weavers
using a Program
Transformation Engine
Jeff Gray
Suman Roychoudhury
Department of Computer and Information Sciences
University of Alabama at Birmingham
Program Transformation A Definition

A program is a structured object with semantics. The
structure allows us to transform a program.

Program transformation is the act of changing one
program (source) into another (target).

The source and target languages could be the same, but
sometimes could be different too.
An AST representation

The structure of the source tree is defined by
the production rules associated with the
grammar…
Statement Node
Condition Statement
If
... Compound
Expression Statement
Return
Var
...
Literal
BooleanExpr
Transforming the source

Plug in new nodes…
Statement List Node
Condition Statement
If
... Compound
Expression Statement
Return
Var
Condition Statement
If
... Compound
Return
...
Literal
BooleanExpr
Case Study




Processing Dialog Meter
Logging of SQL Query Statements
Language Internationalization Utility
Database Error Handler Synchronization
Processing Dialog Meter
Inc(TotalInserts);
if not
ProcDlg1.Process(TotalInserts/TotalCalc)
then
begin
ProcDlg1.Canceled := True;
Result := True;
exit;
end;
// if not Process
Logging of SQL Query Statements
with dmSERVERS.qryCreateTriggers do
begin
<statements that build a SQL Create
Trigger>
LogSQL.AddSQL(dmSERVERS.qryCreateTriggers,
True);
ExecSQL;
end;
Language Internationalization Utility
// The user wants to perform another search using
//the same search criteria
procedure TLangMan.SearchAgainClick(Sender:
TObject);
begin
// Perform an update if an edit occurred that
//might change the focus of the listview
if EditMadeDirtyBit then
SaveDBControls;
…
end;
Database Error Handler Synchronization
function TExNullField.Handle(ServerType:
TServerType; E : EDBEngineError) : Integer;
begin
TExHandleCollection(Collection).LockHandle;
try
<database error handling code omitted here>
finally
TExHandleCollection(Collection).UnLockHandle;
end;
end;
Weaver Construction
Lexer
PARLANSE
f (x)
BACK END
Pattern Instantiation
Aspect
Source
Attribute
Evaluator
RSL
Rules
Delphi Source
Parser
DMS
Transformat
ion Engine
FRONT END
Transformed Delphi Source
Related documents