PFord-slides
Download
Report
Transcript PFord-slides
PFORD
Bhagyashree Bohra
Deepti Jindal
Shringika Porwal
Outline
Introduction
Overview
Examples
Implementation details
Lessons learned
PFORD
A programming language for making
programming easier and translates
complex languages
Some Generation:
C++
Java
Goals
Portability - interpreted and executed by a
java interpreter.
Ease of use - very simple and quick to start
What can the language do?
Basic operations –
addition, multiplication, power,
modulus…
Advanced operations – complex string
operations , array operations
Translation
Operations and Relations
Arithmetic Operations
*, /, %, /’, ‘, +, -, mod, ^
Logical Operations
not and or
Relational Operations
>, >=, <, <=, ==, !=
Statements
Block Statement
{}
iteration
loop n runs{};
loopfrom i to f interval k{};
while(exp) loopthrough{};
=
if (exp) then {};
if (exp) then {} elsedo {};
break_loop;
skip_iteration;
Assignments
Conditional Statements
Break and Continue
Functions and Function call
Self Defined Functions
func <id> (para-list){}
Function Call
id(param-list);
Internal functions (include string)
•Join
Join(a,b) joins strings a and b.
•To Lower
toLower(m) makes all the characters in a string lower case
•To Upper
toUpper( m) makes all the characters in a string upper case
•Mean
mean() computes the mean of an array
•Stddev
stddev() computes the stddev of an array
•Sum
sum() sums all the elements of an array
•PrintArray
print() prints all the elements of an array
•Sort
sort() sorts all the elements of an array
Example 1:
startprogram
w = 3;
x = 10;
func incw()
{
w=w+1;
return w;
};
func incx()
{
x=x+1;
return x ;
}
;
func myfoo(y, z)
{
output y+y;
x = 1;
output z;
}
;
myfoo(incw(), incx());
8
11
What does translation entail
Multiple Walkers. (total 3 right now)
– One for stand alone
– On each for each language
• C++
• Java
Code Statistics
Parts
Front-end Back-End
test code
(translation)
Statistics
(lines)
2410
Total
7650 lines
(partial, currently in CVS)
4590
540
Lessons Learned
1. Fully investigate the feasibility of the
supporting tools
• Ie. translation
2. Get advice from experienced people
3. When an easier method of implementing
classes of function exists, use it
• power
4. When in doubt see Mx
Future
1. Additional functionality
2. Translation to more languages
1. ie perl, C#