9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] A new language for Plan 9
@ 2008-05-02  1:23 Pietro Gagliardi
  2008-05-02  1:26 ` erik quanstrom
                   ` (3 more replies)
  0 siblings, 4 replies; 46+ messages in thread
From: Pietro Gagliardi @ 2008-05-02  1:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2008-05-11 23:04 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-02  1:23 [9fans] A new language for Plan 9 Pietro Gagliardi
2008-05-02  1:26 ` erik quanstrom
2008-05-02  2:21   ` Pietro Gagliardi
2008-05-02  2:34     ` Pietro Gagliardi
2008-05-07  9:24   ` Matt Erickson
2008-05-08  2:22     ` Pietro Gagliardi
2008-05-11 23:04       ` Pietro Gagliardi
2008-05-02  1:52 ` Rob Pike
2008-05-02  1:12   ` Federico G. Benavento
2008-05-02  2:22     ` Pietro Gagliardi
2008-05-02  1:53   ` Rob Pike
2008-05-02  2:19   ` Pietro Gagliardi
2008-05-02  3:22     ` Robert William Fuller
2008-05-02 12:34       ` Chad Dougherty
2008-05-02 14:43         ` Robert William Fuller
2008-05-03 14:07         ` David Arnold
2008-05-03 15:47           ` lucio
2008-05-03 23:28           ` Skip Tavakkolian
2008-05-03 23:32             ` Bruce Ellis
2008-05-03 23:50               ` Pietro Gagliardi
2008-05-04  2:43               ` Eric Van Hensbergen
2008-05-04  5:16                 ` Steve Simon
2008-05-04  5:42                 ` Bruce Ellis
2008-05-04  7:42                   ` John Stalker
2008-05-04  7:48                     ` Steve Simon
2008-05-04  7:57                     ` lucio
2008-05-04 12:18                       ` Bruce Ellis
2008-05-04 13:48                         ` Pietro Gagliardi
2008-05-04 15:03                           ` Eric Van Hensbergen
2008-05-05  1:45                             ` Pietro Gagliardi
2008-05-05  2:24                               ` andrey mirtchovski
2008-05-05  3:58                                 ` erik quanstrom
2008-05-05 10:16                                 ` Pietro Gagliardi
2008-05-05  4:32                               ` Bruce Ellis
2008-05-02  4:25     ` ron minnich
2008-05-02  4:41       ` John Barham
2008-05-02  4:54         ` ron minnich
2008-05-02  5:01           ` John Barham
2008-05-02  4:39   ` John Barham
2008-05-02  5:07   ` andrey mirtchovski
2008-05-02 12:12     ` erik quanstrom
2008-05-02  5:07 ` John Barham
2008-05-02 12:07   ` erik quanstrom
2008-05-02  7:49 ` John Stalker
2008-05-02  8:42   ` Bakul Shah
2008-05-02  9:24     ` Martin Neubauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).