[9fans] A new language for Plan 9
  Home FAQ Contact Sign in
comp.os.plan9 only
 
Advanced search
POPULAR GROUPS

more...

comp.os.plan9 Profile…
 Up
[9fans] A new language for Plan 9         


Author: Pietro Gagliardi
Date: May 1, 2008 18:28

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
Show full article (1.89Kb)
45 Comments
Re: [9fans] A new language for Plan 9         


Author: erik quanstrom
Date: May 1, 2008 18:33

> 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.

don't forget fortran.

- erik
2 Comments
Re: [9fans] A new language for Plan 9         


Author: Rob Pike
Date: May 1, 2008 18:55

Indentation by white space is a very bad idea in my experience.
Superficially attractive but ultimately very dangerous. I once spent a
couple of days tracking down a bug caused by a source-to-source code
tool that broke a major program because the code it was injecting into
had indented one more space, causing the injecting code to break the
control flow. It was nearly impossible to track down.

I have lots of other examples of lesser disasters. As code grows,
white space indentation becomes ever more problematic. It's a
maintenance disaster.

Put it this way: It's unwise to make program structure depend on
invisible characters.

-rob
11 Comments
Re: [9fans] A new language for Plan 9         


Author: Rob Pike
Date: May 1, 2008 18:55

(By 'indentation' of course I mean 'indentation to define structure')

-rob
no comments
Re: [9fans] A new language for Plan 9         


Author: Federico G. Benavento
Date: May 1, 2008 19:16

> Put it this way: It's unwise to make program structure depend on
> invisible characters.

a white space is something hard to find, some time ago I helped a friend
who couldn't get a mkfile working, he got something like:
"mk: mkfile:6: syntax error; expected one of :<="
all due to a ' ' in what was supposed to be an empty line.

Federico G. Benavento

---
/bin/fortune:
You are in a maze of twisty little passages, all alike.
1 Comment
Re: [9fans] A new language for Plan 9         


Author: Pietro Gagliardi
Date: May 1, 2008 19:25

On May 1, 2008, at 9:52 PM, Rob Pike wrote:
> Indentation by white space is a very bad idea in my experience.
> Superficially attractive but ultimately very dangerous. I once spent a
> couple of days tracking down a bug caused by a source-to-source code
> tool that broke a major program because the code it was injecting into
> had indented one more space, causing the injecting code to break the
> control flow. It was nearly impossible to track down.
>
This scenario is why I decided to require hard tabs as indents. You
can't use a space. But a space halts the indentation, so the problem
is still there. The next version will just ignore spaces, and treat
the first non-whitespace character as the beginning of a line.
Show full article (1.22Kb)
4 Comments
Re: [9fans] A new language for Plan 9         


Author: Pietro Gagliardi
Date: May 1, 2008 19:27

On May 1, 2008, at 9:26 PM, erik quanstrom wrote:
>> 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.
>
> don't forget fortran.
>
[off topic] I wonder why it took 20 or so years for Fortran to
introduce IF..ELSE..END IF. Probably after Kernighan and Plauger,
1974, it finally came to Backus' senses. :-P
1 Comment
Re: [9fans] A new language for Plan 9         


Author: Pietro Gagliardi
Date: May 1, 2008 19:22

On May 1, 2008, at 9:12 PM, Federico G. Benavento wrote:
>> Put it this way: It's unwise to make program structure depend on
>> invisible characters.
>
> a white space is something hard to find, some time ago I helped a
> friend
> who couldn't get a mkfile working, he got something like:
> "mk: mkfile:6: syntax error; expected one of :<="
> all due to a ' ' in what was supposed to be an empty line.
>
> Federico G. Benavento
>
Another thing: lines with only whitespace are naturally ignored (as
far as I know - I am human) and don't break the block structure.

The space in an empty line should be a bug, right?
no comments
Re: [9fans] A new language for Plan 9         


Author: Pietro Gagliardi
Date: May 1, 2008 20:21

On May 1, 2008, at 10:21 PM, Pietro Gagliardi wrote:
>
> On May 1, 2008, at 9:26 PM, erik quanstrom wrote:
>
>>> one does
>>>
>>> if key = 'c' then
>>> scanline
>>> runcommand
>>> else
>>> generate(key)
>>> assemble(key)
>>>
>>> This is similar...
Show full article (1.05Kb)
no comments
Re: [9fans] A new language for Plan 9         


Author: Robert William Fuller
Date: May 1, 2008 20:43

Pietro Gagliardi wrote:


>> Put it this way: It's unwise to make program structure depend on
>> invisible characters.
> There's a language made entirely of said invisible characters, called
> Whitespace. It's esoteric, but it works. And Python, which has the same
> style, is a phenomenal success. Whether or not indentation works relies
> on the programmer.

I don't use Python for this very reason. This is probably why Ruby
exists. I will not use your language for the same reason. By adopting
such draconian white space rules you automatically alienate a large
number of programmers.

I consider this one of the larger mistakes in programming language
design, akin to making the period the most important token in the COBOL
language, or using whitespace as a separator in FORTRAN (which
incidentally lost NASA a space probe.)
no comments
1 2 3 4 5