SASSi Carl Morgan (Group Leader) Paul Salama Xiaotang Zhang

advertisement
SASSi
Carl Morgan (Group Leader)
Paul Salama
Xiaotang Zhang
Why be SASSi?
• Our motivation was to design a language
to let a user make quick and simple
programs to deal with various statistical
problems
• But what about SAS and other statistics
programs?...
Unlike SASSi…
• SAS and other programs like it are big and
bulky in terms of maintenance, learning
curve, and installation
• They also cost a bunch. $$$$$$$=bad
• SASSi is free!!!! (currently)
• SASSi is simple, easy to learn, and easy
to use
What can SASSi do?
• Handles many standard statistical
problems such as getting the mean,
median, standard deviation, etc. for a set
of numbers. Defined as a “vector” in
SASSi
• Supports more complicated statistical
problems like regressions, distributions,
etc.
• Graphical output.
What SASSi looks like
Double b;
Vector a=[1,1,2,3,5,8];
b=mean(a);
print(“The mean of a is: ”);
print(b);
plot(bar,a);
More Samples
• SASSi allows users to define their own
procedure calls
• Example:
procedure Vector foo( Double sheep, Double cow )
{
Double dog = sheep*cow;
sheep = sheep+1;
Vector animals=[sheep, cow, dog];
//etc…
return animals;
}
SASSi grammar (1)
• Types of data
bool: Boolean values that can either be true or false (and True/False and
TRUE/FALSE)
int: standard 32-bit integers
double: 64-bit IEEE double floating-point format
string: a string of characters
procedure: a user defined procedure
vector: an M by 1 vector of doubles
• Expressions - Very similar to C:
Primary expression: Identifiers, constants, procedure calls, and access to
vector types
Arithmetic expressions: “+”, “-”, “*”, “/”
Relational expressions: “<=”, “>=”, “==”, “<”, “>”, and “<>”
SASSi grammar (2)
• Constants implemented by:
const
int a = 3;
.
.
xconst
• Include statement:
include <path name>;
SASSi grammar (3)
• Statements
Assignments
Direct assignment in the form:
left-valued expression = right-valued expression;
Conditional Statements
if( relational expression)
{
statement
}
else
{
statement
}
For Loops
for( assignment ; relation expression ; action)
{
statement
}
SASSi built-in procedures
• Basic statistic methods:
mean, median, stdDev, etc…
• Dealing with vectors:
sort, range, union, intersect, etc…
• Distributions:
normal, standard, geometric, etc…
• Regression:
linear
SASSi Plotting
• SASSi supports five built-in graphing
functions:
Bar
Pie Chart
Line
Error
Curve
SASSi printing
• Printing variables (Doubles, Int, and Vector)
print(v);
• Printing strings
print(“Who knows why you name something foo?”);
SASSi implementation
ANTLR
*.ssi file
LEXER
Tokens
PARSER
AST
Tree
AST
WALKER
Interm.
Code
CODE
GENERATOR
Java
Bytecode
SASSi Summary
• SASSi is an efficient, small, FREE,
statistics language
• Expandable with user procedures/plots:
So even though we didn’t include
Poisson distributions, someone could
include it in the future…
• Enough functionality for a base of statistics
Lessons Learned
• Not sticking to your schedule is bad
• Meeting twice a week is far more effective and
comforting than just once
• Don’t try to implement all statistics functions, or
all of C
• Get feedback from your TA. They’re there to
help, and have been there before
• Think big, build small
• Decide if what you think is a language would be
better off as a program. If so, don’t try to
implement it as a language
THE END
Download