9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] A new language for Plan 9
Date: Thu,  1 May 2008 21:23:44 -0400	[thread overview]
Message-ID: <3CB4093E-098C-4E6F-B843-7B65E4461D81@mac.com> (raw)

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




             reply	other threads:[~2008-05-02  1:23 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02  1:23 Pietro Gagliardi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CB4093E-098C-4E6F-B843-7B65E4461D81@mac.com \
    --to=pietro10@mac.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).