Stuff like that is more the province of the text editor. Good editors deal with indentation automatically, and highlight matching braces. A pretty-printer can always be used to tidy up one's code, even if the editor isn't any good.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Oh, fooey! Everyone knows the only real programming language is FORTH! [noparse]:D[/noparse]
When I first opened the Prop manual, and saw my first Prop Prog, I thought, "Ah! A Pascallian language!" Then I saw the indentation blocking and thought, "With a bit of Python!" Then I tried to do a FOR loop, and thought, "HUH??" [noparse];)[/noparse]
As to C, we may as well call it an MLL -- a Medium Level Language. I see C all day here at work. Some is, at best, wretched, and other (mine!) is beautiful. THe first thing I MUST do before looking at someone else's code is to indent it properly:
switch(z){
case 1:
/* twenty
lines
of code */
break;
case 27:
/* MotS */
just does not work! (MotS == More of the Same) One thing I did a long time ago was to make macros to make C more understandable.
if((A b_and 3) L_OR ((B b_and C) b_and D)))
is easier for me than
if((A&3)|((B&C)&D)))
... and it's easier to catch the error.
I like the Propeller and Spin. They were both easy to learn and apply. I only wish the examples in the manual went further than they do.
The first time I saw an Asynchronous Javascript (a cousin of C) and XML (AJAX) program all on one line it was freaky. How am I supposed to read that ? [noparse]:)[/noparse] Well, it was made for a browser Javascript engine presumably to save bandwidth by leaving out white-space and not for human consumption (though I'm sure an intermediate form could be used). Spin would not work in that particular situation of course. I assume Javascript is not byte-codes oriented because it's a "script".
As for the number of braces or parenthesis on a source line, it is quite annoying to have a huge conditional or loop terms in C. I am also not a fan of multiply nested ternary conditionals (i.e. z = a ? y : b ? x : c ? ...)
@Leon, if a decision is made from product genesis to use a pretty printer for committed code (manually or by commit tool), then what you said makes sense, otherwise it's just asking for trouble in large projects or other situations where code is not "single source" dependent (i.e. many copies of one file are made for various reasons).
Added:
My first experience with C was from a book where the very first example was missing exactly one semicolon ";" at the end of a line. I scratched my head over that one for three days. Once I understood the problem, forgetting the semicolon was and has been quite rare. "Take the pebble from my hand Grasshopper." It also encouraged me to give much, much more attention to what people write [noparse]:)[/noparse]
I can sympathize, I had the same experience with a $30.00 Coldfire kit from Freescale, it was a joke, the C compiler - Code Warrior suite was bloated(1 gigabyte all told) and slow(it made Altera Quartus look like a speed demon). Coding for the chip was a pain in the *** since the C examples were more difficult to read than ColdFire assembly.
Talk about taking all the fun out of working with micros. The Coldfire kit now sits in the closet along with my 68HC16 board.
The Prop IMO wins hands down in terms of ease of programming and use. You won't find another 32 bit chip that is as hobbyist friendly.
I hate to admit it because I just don't get the value of emulation unless you're replacing one chip with another, but having a big "solid GCC" carrot makes it very attractive.
GNU tool chain for X86 is superb (GNU for MIPS64 somewhat less artful, but very important in industry). How well is GNU/GCC for 6809 maintained ?
Jazzed: Well MoCog, like the Z80 emulation, was/is never intended as a serious development tool for the Prop. It's just my for my amusement. Hopefully others can have fun with it to. The idea came about originally as just a first learning exercise in Prop/Spin/PASM and to avoid having to actually build a Z80 board which I was about to do before discovering the Prop.
However it seems to have helped to push some some good things along, like Cluso's external RAM designs and OBC's VT100 terminal emulation.
As for 6809 GCC you can check it out here: www.oddchange.com/gcc6809/index.html. Brian Dominy has been very active with this, it is not in an "official" part of GCC.
I only just started playing with it so I'm not sure how solid it is. It does seem to pass the gcc test suite so should be useful. No idea how optimal the code generation is but I did notice that turning on optimizations can result totally non functional code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
heater: It is not your *effort* that I find of questionalble value. All explorations in an inquiring mind will lead to many satisfying paths and "discoveries" that are new to the enquirer at least and at greatest or best a completely new discovery that will benefit the human condition.
Memory solutions for propeller have been coming since propeller was released ... says something about the real need for a fast respin to support more memory huh? I've also looked at multiple propeller solutions since last year along with dram, sdram, psram, and sram yada yada yada. I get VT100 on many PC programs, but that does not mean the *effort* to creating a new one has no value.
Emulations are interesting on the PC if there is enough justification for them. Replacing 30 or 40 year old hardware with something just as limiting has no value though unless you're extremely attached to your for some reason other than being too cheap to invest in your business by upgrading to a sustainable solution.
Not being an official part of GCC is not really a problem, since the maintainer/organizer is probably shooting for integration at some point. Finding enough people who care about it is the hard part. I guess the good news is that a small number of contributors would mean less change on the main-line.
Propeller has a good fit for many applications. If there is market demand for emulation, that's great. If you have gotten a great deal of intellectual entertainment out of it, that's even better. I wish you continued success and happiness.
ZiCog (and now MoCog) is a true "tour de force". You can't really justify or explain such a thing - once created, it simply exists for its own sake. All the rest of us can do is look on in awe and admiration
But as well as existing for its own sake, it is also quite an elegant means of running a self-contained development environment on the Propeller - i.e. it allows you to run an OS on the Prop, and compile programs using the Prop, and then have them executed by the Prop - something no-one else can (as yet) achieve. Getting the gcc toolchain running this way would be yet another level of achievement, since it is not only gcc you need - you must also build a complete environment for gcc to run in - you have your choice here, but for gcc some variant of unix would be the obvious one.
But this is still only using gcc as a cross-compiler - in this case generating 6809 code. The results could be run natively on a real 6809 (or these days on a 6809 core implemented in an FPGA), but can only be run anywhere else under software emulation. It is true that in this case the physical host happens to be a Propeller, but in terms of functionality it is little different to running gcc anywhere else (except probably a lot slower!) - gcc is not being used to compile anything specifically for the Prop. In many ways, that is a lot simpler - if you're willing to have your development environment hosted elsewhere, all that requires is a Propeller-specific code generator.
I'm sure someone somewhere is working feverishly on a gcc code generator for the Prop (as opposed to an lcc one, which is relatively simple by comparison) - but in some ways I hope it doesn't come soon, because at that point it means the Propeller has well and truly become just another mainstream microcontroller, and things like ZiCog/MoCog (not to mention Catalina) will no longer engage so much of our time and enthusiasm. An era will have passed - Parallax will be selling zillions of Propeller chips each year, but the rest of us will have to find something else to amuse us.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
But as well as existing for its own sake, it is also quite an elegant means of running a self-contained development environment on the Propeller - i.e. it allows you to run an OS on the Prop, and compile programs using the Prop, and then have them executed by the Prop - something no-one else can (as yet) achieve.
Is there really any interest in Prop-based development?
I think mpark was specifically questioning the need for "self-hosted" prop development. And it's not an unreasonable question - apart from the "cool" and "kudos" factors, what lunatic would really want to develop on the Prop itself - especially when a complete laptop actually costs less than a propeller board (plus all the necessary peripherals - screen, keyboard, mouse etc etc) anyway?
Of course, you can count me amongst the lunatics, since I'm also working towards it [noparse]:)[/noparse]
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Chip would.. (So at least us lunatics are in good company. [noparse]:)[/noparse]
IIUC, a secondary goal of his with Prop II is to ditch the requirement of a PC.
I'd love to see us collectively get this going before he gets here. [noparse]:)[/noparse]
{of course I think he's planning some type of GUI for it.}
Though SPIN is an interesting language, it will never be my favorite. The professional side of me deals daily with multi-million line programs
and much of that knowledge seeps over to the hobbyist side.
Sure, it achieves the limited design objectives of presenting itself as a somewhat easy language to pick up for people that have
never programmed before (at the expense of being idiosyncratically different in many places from any other language to confuse
those of us that have programmed before), and compiling to a small set of instructions that can be run in a stackless interpreter.
But if it weren't the primary language for the Propeller, I personally would never have used it. SPIN as a language is too much of a
limited pidgin applicable to a single chip.
Languages I am confortable with: x86 assembler, C, C++, Objective C, Common Lisp, Python, Perl, Tcl, Verilog, VHDL, System Verilog
(and yes, they all have their own limitations and applicability)
jazzed said...
Tour de force or not, Propeller CPM emulation is just not interesting to me or anyone else beyond the influence of this asylum [noparse]:)[/noparse]
Don't be so sure... These guys live in an adjacent "facility". [noparse]:)[/noparse] [noparse]:)[/noparse]
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
When I first opened the Prop manual, and saw my first Prop Prog, I thought, "Ah! A Pascallian language!" Then I saw the indentation blocking and thought, "With a bit of Python!" Then I tried to do a FOR loop, and thought, "HUH??" [noparse];)[/noparse]
As to C, we may as well call it an MLL -- a Medium Level Language. I see C all day here at work. Some is, at best, wretched, and other (mine!) is beautiful. THe first thing I MUST do before looking at someone else's code is to indent it properly:
just does not work! (MotS == More of the Same) One thing I did a long time ago was to make macros to make C more understandable.
is easier for me than
... and it's easier to catch the error.
I like the Propeller and Spin. They were both easy to learn and apply. I only wish the examples in the manual went further than they do.
(My two scents!)
--Rich
As for the number of braces or parenthesis on a source line, it is quite annoying to have a huge conditional or loop terms in C. I am also not a fan of multiply nested ternary conditionals (i.e. z = a ? y : b ? x : c ? ...)
@Leon, if a decision is made from product genesis to use a pretty printer for committed code (manually or by commit tool), then what you said makes sense, otherwise it's just asking for trouble in large projects or other situations where code is not "single source" dependent (i.e. many copies of one file are made for various reasons).
Added:
My first experience with C was from a book where the very first example was missing exactly one semicolon ";" at the end of a line. I scratched my head over that one for three days. Once I understood the problem, forgetting the semicolon was and has been quite rare. "Take the pebble from my hand Grasshopper." It also encouraged me to give much, much more attention to what people write [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Post Edited (jazzed) : 6/19/2009 5:17:11 PM GMT
I can sympathize, I had the same experience with a $30.00 Coldfire kit from Freescale, it was a joke, the C compiler - Code Warrior suite was bloated(1 gigabyte all told) and slow(it made Altera Quartus look like a speed demon). Coding for the chip was a pain in the *** since the C examples were more difficult to read than ColdFire assembly.
Talk about taking all the fun out of working with micros. The Coldfire kit now sits in the closet along with my 68HC16 board.
The Prop IMO wins hands down in terms of ease of programming and use. You won't find another 32 bit chip that is as hobbyist friendly.
In a short while the Prop will be able to run C code compiled with GCC via MoCog the 6809 emulator[noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
GNU tool chain for X86 is superb (GNU for MIPS64 somewhat less artful, but very important in industry). How well is GNU/GCC for 6809 maintained ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
However it seems to have helped to push some some good things along, like Cluso's external RAM designs and OBC's VT100 terminal emulation.
As for 6809 GCC you can check it out here: www.oddchange.com/gcc6809/index.html. Brian Dominy has been very active with this, it is not in an "official" part of GCC.
I only just started playing with it so I'm not sure how solid it is. It does seem to pass the gcc test suite so should be useful. No idea how optimal the code generation is but I did notice that turning on optimizations can result totally non functional code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Memory solutions for propeller have been coming since propeller was released ... says something about the real need for a fast respin to support more memory huh? I've also looked at multiple propeller solutions since last year along with dram, sdram, psram, and sram yada yada yada. I get VT100 on many PC programs, but that does not mean the *effort* to creating a new one has no value.
Emulations are interesting on the PC if there is enough justification for them. Replacing 30 or 40 year old hardware with something just as limiting has no value though unless you're extremely attached to your for some reason other than being too cheap to invest in your business by upgrading to a sustainable solution.
Not being an official part of GCC is not really a problem, since the maintainer/organizer is probably shooting for integration at some point. Finding enough people who care about it is the hard part. I guess the good news is that a small number of contributors would mean less change on the main-line.
Propeller has a good fit for many applications. If there is market demand for emulation, that's great. If you have gotten a great deal of intellectual entertainment out of it, that's even better. I wish you continued success and happiness.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
ZiCog (and now MoCog) is a true "tour de force". You can't really justify or explain such a thing - once created, it simply exists for its own sake. All the rest of us can do is look on in awe and admiration
But as well as existing for its own sake, it is also quite an elegant means of running a self-contained development environment on the Propeller - i.e. it allows you to run an OS on the Prop, and compile programs using the Prop, and then have them executed by the Prop - something no-one else can (as yet) achieve. Getting the gcc toolchain running this way would be yet another level of achievement, since it is not only gcc you need - you must also build a complete environment for gcc to run in - you have your choice here, but for gcc some variant of unix would be the obvious one.
But this is still only using gcc as a cross-compiler - in this case generating 6809 code. The results could be run natively on a real 6809 (or these days on a 6809 core implemented in an FPGA), but can only be run anywhere else under software emulation. It is true that in this case the physical host happens to be a Propeller, but in terms of functionality it is little different to running gcc anywhere else (except probably a lot slower!) - gcc is not being used to compile anything specifically for the Prop. In many ways, that is a lot simpler - if you're willing to have your development environment hosted elsewhere, all that requires is a Propeller-specific code generator.
I'm sure someone somewhere is working feverishly on a gcc code generator for the Prop (as opposed to an lcc one, which is relatively simple by comparison) - but in some ways I hope it doesn't come soon, because at that point it means the Propeller has well and truly become just another mainstream microcontroller, and things like ZiCog/MoCog (not to mention Catalina) will no longer engage so much of our time and enthusiasm. An era will have passed - Parallax will be selling zillions of Propeller chips each year, but the rest of us will have to find something else to amuse us.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
Post Edited (RossH) : 6/20/2009 2:00:56 AM GMT
Yeah, like day-dreaming about getting the inside scoop on the Prop III
[noparse]:)[/noparse])
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Is there really any interest in Prop-based development?
Are you kidding???!
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
I think mpark was specifically questioning the need for "self-hosted" prop development. And it's not an unreasonable question - apart from the "cool" and "kudos" factors, what lunatic would really want to develop on the Prop itself - especially when a complete laptop actually costs less than a propeller board (plus all the necessary peripherals - screen, keyboard, mouse etc etc) anyway?
Of course, you can count me amongst the lunatics, since I'm also working towards it [noparse]:)[/noparse]
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
IIUC, a secondary goal of his with Prop II is to ditch the requirement of a PC.
I'd love to see us collectively get this going before he gets here. [noparse]:)[/noparse]
{of course I think he's planning some type of GUI for it.}
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
and much of that knowledge seeps over to the hobbyist side.
Sure, it achieves the limited design objectives of presenting itself as a somewhat easy language to pick up for people that have
never programmed before (at the expense of being idiosyncratically different in many places from any other language to confuse
those of us that have programmed before), and compiling to a small set of instructions that can be run in a stackless interpreter.
But if it weren't the primary language for the Propeller, I personally would never have used it. SPIN as a language is too much of a
limited pidgin applicable to a single chip.
Languages I am confortable with: x86 assembler, C, C++, Objective C, Common Lisp, Python, Perl, Tcl, Verilog, VHDL, System Verilog
(and yes, they all have their own limitations and applicability)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
Jo
Don't be so sure... These guys live in an adjacent "facility". [noparse]:)[/noparse] [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
DOS Rules!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230