From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <3CB4093E-098C-4E6F-B843-7B65E4461D81@mac.com> From: Pietro Gagliardi To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Thu, 1 May 2008 21:23:44 -0400 Subject: [9fans] A new language for Plan 9 Topicbox-Message-UUID: 9c54ad1c-ead3-11e9-9d60-3106f5b1d025 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