Anyone for Pascal ?
hippy
Posts: 1,981
Having implemented a good chunk of the Javelin VM ( see other thread ) and while up against the wall reading JVM specifications to get a better understanding of Java runtimes, it occurred to me that what I'd done amounted to what's needed for a Pascal implementation which would be much simpler than Java; Pascal := Java - Classes, ish.
So for 'light entertainment'; Pascal P4 for the Propeller.
The P4 compiler is open-source so can be modified and tailored to make it more Propeller Chip friendly and useful. It's not a complete Standard / ISO 7185 Pascal but a reasonable implementation.
I've found a Pascal P4 compiler executable, have a 'linker' written to convert P4 p-code to P4 VM bytecode and most of the VM implemented and running. A few (major) bugs stopping a public release but that should arrive soon. I'll post it here, and have created a Wiki page for the project in the meantime ...
propeller.wikispaces.com/Programming+in+Pascal
So for 'light entertainment'; Pascal P4 for the Propeller.
The P4 compiler is open-source so can be modified and tailored to make it more Propeller Chip friendly and useful. It's not a complete Standard / ISO 7185 Pascal but a reasonable implementation.
I've found a Pascal P4 compiler executable, have a 'linker' written to convert P4 p-code to P4 VM bytecode and most of the VM implemented and running. A few (major) bugs stopping a public release but that should arrive soon. I'll post it here, and have created a Wiki page for the project in the meantime ...
propeller.wikispaces.com/Programming+in+Pascal
Comments
I'm a real supporter of an extended Pascal for systems programming. It's specific for the 68000 and ARM processors, but Palm Pascal is a great example of the kinds of extensions needed (see www.ppcompiler.org/?lng=en). It's written in a mixture of Palm C and Palm Pascal and runs on the Palm itself.
Post Edited (Mike Green) : 1/29/2008 9:29:19 PM GMT
The advantage of P4 is that I am relatively familiar with it, there was a ready-built compiler executable, but more importantly it generates p-code which is both simple and very well documented ( as is the entire code generation process ). That means it's just a case of writing the linker/assembler and the VM so it's not an overly onerous task I've set myself.
> ever used ...
... after having been forced to use BASIC for a few months. At least in my case.
Albeit I like (or liked Pascal), I wouldn't use it for µC-programming. Not dirty enough.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Saluti Joerg
Objective-C!
<http://en.wikipedia.org/wiki/Objective-C>
<http://www.gnustep.org/resources/ObjCFun.html>
<http://gcc.gnu.org/>
Does what C can do, not the bloat of C++, almost dynamic object model, a bit slower when dealing with objects (compared to C++), GCC supports it.
Haven't used it since some years. :-(
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
After Spin, Java and Pascal I might head in the opposite direction ...
en.wikipedia.org/wiki/One_instruction_set_computer
I'll write the Virtual Machine if someone else writes a HLL compiler.
Steven
But nifty would be to have it running in the propeller. A PC can do almost anything.... (anybody remember the C compiler for Z80 CP/M ?)
'Don't know how BF escaped me all these years. Thanks for mentioning it. Despite the unfortunate name and obvious impracticality, it's gotten some surprisingly serious attention. Looking at the BF interpreter written in BF (!), one is reminded immediately of DNA. Ignoring, for the moment, the syntax requirement for balanced brackets, it might be considered a candidate language for genetic optimization. (I'm not seriously thinking of pursuing it, though!)
-Phil
If you want to compile programs to test, you'll need to download the 'pcom.exe' compiler ( into the directory the attached is extracted to ) ...
www.moorecad.com/standardpascal/pcom.exe
Then from that directory edit 'test.pas' as desired, then run "MAKE test". After successful compilation, switch to the PropTool, download the AiChip_P4_001.spin and you should see the bytecode being interpreted on an attached TV.
Steven
@ BEEP : I get the same error message under Win 98SE but it works under my XP, so assumed it was 32-bit only. I've no idea what's missing or is need to make Pcom.exe work. Sorry.
I've tried many compilers to re-compile the Pcom source but no luck so far ( major issues, not just changing compile settings and variable names etc ). It's going to be impossible to handle strings in the constant pool and arrays of char unless I can - or every string constant has to be 200 words/longs due to lack of context information [noparse]:([/noparse]
Looks like Pascal has hit a brick wall. Pointless to go backwards to PL/0 or Pascal-S as they don't implement enough Pascal to make it worthwhile. Same problems with Modula, Oberon and Ada bytecode generating compilers I've looked at in the other direction.
C-Flea looked very promising to have a C up and running in a week or two, but commercial and very draconian licensing. So looks like it's back to Java/Javelin, although I have one other compiler / language ( not Lua ) which I'm looking at. Don't want to get bogged down with having to code a whole compiler if I can help it.
-Phil
BUT by the time you get it done... I might already have translated my code into Spin/ASM.
I don't know how much legacy code is around... but I'll bet it is everywhere. When Apple dropped Pascal, I dropped Apple... went to Java and haven't been truly happy since[noparse]:)[/noparse] Pascal was the last language that I was happy with.
In my opinion the greatest virtue of the Prop is that we can touch the processor with as little or as much of an operating system in between us and the machine as we choose.
BUT I also don't think that developing Pascal could possibly be a mistake.
The nice thing about a Pascal compiler source is that by taking a few liberties ( get lax with semicolon checking, allow { } for begin end, int for integer etc, add a few context sensitive parsing routines ) one can produce a compiler which accepts Pascal but allows C-like programming and also VB-like, of which ...
@ Phil : I'm not familiar with SmallTalk so wouldn't want to get into something which were such unknown territory. I think the JVM/Javelin experience has also revealed just how much more complicated real object handling and garbage collection makes things over a traditional procedural language.
What I was thinking of was Visual Basic(R), or more accurately a VB-subset as used by Basic-X ( NetMedia Inc ) and Basic-ZX/ZBasic ( Elba Corp ). The ZBasic and C-Flea compilers are licensed only for use to generate code for their own target products, but Basic-X tools don't appear to have that licensing restriction.
I know the mere thought of VB will cause some people to shudder but it's viable enough that at least two embedded companies are built upon its use and, IMO, most procedural programming languages are the same except for the distinct syntax forced upon programmers.