Hello. I started working on Bentley, a new programming language. This
was inspired by and is based on the pseudocode in Jon Bentley's
"Programming Pearls" - a column for the CACM that became a book. The
compiler generates Assembly in a temporary file, then calls up the
assembler to make the program. Currently, the assembly that can be
generated is a subset of the language that can be parsed, but I'm
working on it.
% rc /n/sources/contrib/pietro/bentley.bundle
...
% mk
...
% 8b asm.b
% 8l -o asm asm.8
% asm
5
1
% cat test.b # for what the parser is capable of
The idea is simple: indentation as block style. Instead of
if (key == 'c') {
scanline();
runcommand();
} else {
generate(key);
assemble(key);
}
one does
if key = 'c' then
scanline
runcommand
else
generate(key)
assemble(key)
This is similar to Python, and prevents the nesting ambiguity of C,
Pascal, and some other languages that use block delimiters.
Another feature I hope to supply is bit arrays.
x: 32 bits
x := 406 { a bit array is stored atomically }
x[2] ;= 0 { and yet can be used structurally }
On the x86 platform, the BTS, BTC, and BT instructions facilitate
this. I don't know their equivalents on other processors. This feature
is completely independent of endianness if I use the instructions.
Bentley also will have nested functions, a Pascal-like for statement
(with variable steps instead of 1/-1), and a loop statement for
infinite loops.
To ensure programmers will use good style, Bentley will lack goto. To
break out of nested loops, you can use the breakout statement.
Finally, there will be two modes: hosted and standalone. The
standalone keyword changes this. Hosted mode can access print to
stdout and stderr, read from stdin, new, renew (like realloc), delete,
and a string type.
Pietro