02.06.2013 Views

MAFCOG 1.0A Generic code generator for Mathematical Functions

MAFCOG 1.0A Generic code generator for Mathematical Functions

MAFCOG 1.0A Generic code generator for Mathematical Functions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.~ Higher Quality:<br />

v ,<br />

'""<br />

Generated <strong>code</strong> is error free and well<br />

designed." Development teams are more<br />

consistent. Automatic <strong>code</strong> generation<br />

ensures that software developers are more<br />

likelv to be focused on the business<br />

requirements than the more mundane task<br />

of coding.<br />

2.3 Lower Maintenance Costs:<br />

.,'<br />

The <strong>code</strong> generated by <strong>MAFCOG</strong> 1.0 will<br />

be very easy to understand and there<strong>for</strong>e<br />

easier to maintain. The true long-term value<br />

of <strong>code</strong> generation emerges when there are<br />

new" business requirements. Ongoing<br />

maintenance costs are reduced because it is<br />

easier to regenerate <strong>code</strong> than to make<br />

manual <strong>code</strong> changes. There are two<br />

";:primary components used in <strong>MAFCOG</strong> 1.0<br />

• Formula Parsing engine<br />

• Code generation engine<br />

The Formula Parsing engine is a plat<strong>for</strong>m<br />

that hosts grammar files (called JJ files)<br />

with the help of which, actual <strong>for</strong>mula<br />

parsing can be done. There are a variety of<br />

grammar files that you can plug in to the<br />

engine to generate <strong>code</strong> a particular way.<br />

Code generation engine implements a<br />

template-based" approach that allows to<br />

specify the architectural aspects of the <strong>code</strong><br />

under construction. To do this, it provides a<br />

specific Meta Model.<br />

it comprises a set of rules <strong>for</strong> <strong>for</strong>mula <strong>code</strong><br />

generation on how to read <strong>for</strong>mula, splitting<br />

them into tokens, interpret them, get the<br />

rules from defined templates and extract<br />

in<strong>for</strong>mation from them to generate <strong>code</strong>.<br />

The meta model planner then matches parts<br />

and also provides the paths and directions<br />

needed when creating a new template.<br />

3.0 HO'V <strong>MAFCOG</strong> 1.0 GENERATES<br />

CODE?<br />

National Conference on Computing and Applications<br />

363<br />

The following describes the process used by<br />

<strong>MAFCOG</strong> 1,0 engine to generate <strong>code</strong>.<br />

Details of each step follow this section.<br />

Figl.1 :\1AFCOGl.O Processes<br />

3.1 Formula Parsing And Validation<br />

The <strong>for</strong>mula provided by the user wi 11 be<br />

parsed and validated against the defined<br />

grammar. The tokens from the <strong>for</strong>mula are<br />

split up into tokens and the in<strong>for</strong>mation is<br />

extracted to generate the <strong>code</strong>.<br />

3.2 Xt\fL Template Parsing And Rules<br />

Generation<br />

Formula Parsing engine will provide the<br />

input to XML parser, which is a ruleexpanding<br />

planner, implemented in Java.<br />

Rules have associated constraints that can<br />

refer to knowledge bases (templates) that<br />

are constructed from the input to the<br />

<strong>generator</strong>. the planner matches parts of this<br />

input to select appropriate templates (i.e.,<br />

partial derivation trees) and then parse the<br />

templates, generate rules and fills them with<br />

data from the input.<br />

. 3.3 Code Generation<br />

This is where the heavy lifting happens.<br />

This involves reading the XML rules,<br />

selecting the appropriate data; bind it into a<br />

proper <strong>for</strong>mat. More than one template can<br />

be used to generate <strong>code</strong> <strong>for</strong> any given<br />

class; the default templates may be used, or<br />

a customized version may be used,<br />

depending on configuration.<br />

4. 0 <strong>MAFCOG</strong> 1.0 ARCHITECTURE:<br />

As shown in Figure 1.2, <strong>MAFCOG</strong> 1.0<br />

typically contains three layers Formula<br />

j

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!