The Picky Programming Language
Picky is a programming language intended for a first course on computer programming. It is more similar to a bicycle with two side-wheels than it is to a motor-bike. You won’t probably use it unless you are using it for your first steps in programming.
The compiler generates byte-code, interpreted by an abstract machine for portability. The language is utterly picky, hence its name, by design.
- White paper explaning the language.
- Picky: A New Introductory Programming Language. Article published in the Journal of Computational Science Education. Also available here.
- Textbook (Spanish) for the course using the language. The printed version is available in Lulu.
- Source code for the compiler and abstract machine.
This is an example program:
program Word;
consts:
Maxword = 30;
types:
Tindchar = int 1..Maxword;
Tchars = array[Tindchar] of char;
Tword = record{
chars: Tchars;
nchars: int;
};
function isblank(c: char): bool
{
return c == ' ' or c == Tab or c == Eol;
}
function nc(w: Tword): int
{
return w.nchars;
}
procedure skipblanks(ref end: bool)
c: char;
{
do{
peek(c);
if(c == ' ' or c == ' '){
read(c);
}else if(c == Eol){
readeol();
}
}while(not eof() and isblank(c));
end = eof();
}
procedure readword(ref w: Tword)
c: char;
{
w.nchars = 0;
do{
read(c);
w.nchars = w.nchars + 1;
w.chars[w.nchars] = c;
peek(c);
}while(not eof() and not isblank(c));
}
procedure writeword(w: Tword)
i: int;
{
write("'");
for(i = 1, i <= w.nchars){
write(w.chars[i]);
}
write("'");
}
procedure initword(ref w: Tword)
i: int;
{
w.nchars = 0;
for(i = 1, i <= Maxword){
w.chars[i] = 'X';
}
}
procedure main()
done: bool;
w: Tword;
max: Tword;
{
initword(w);
initword(max);
do{
skipblanks(done);
if(not done){
readword(w);
if(nc(w) > nc(max)){
max = w;
}
}
}while(not eof());
writeword(max);
write(" with len ");
writeln(nc(max));
}