pascal

HI, do you guys know how to program the arduino with pascal? tnx

No, that's an oxymoron. Arduino is C/C++.

Pascal, now theres something you don’t see too much of these days, I was a dab hand with Borland Turbo Pascal in my younger days… :slight_smile:

Delphi?

I was imagining something like babuino
that lets you emulate logo (picoboard PIC), or the ladder lenguage simulators for avr,

also motivating my question this, from the Compiler Manual for E-LAB AVRco

“Surely many arguments for or against a language can be relegated to philosophy, but the fact is, that in military or space projects, “C“ is prohibited, only the Pascal related language ADA is allowed. Jobs relevant for security, for example controlling railways and plane electronics are often written in Pascal not in “C“. This
is surely not because of nostalgic reasons. So much to our decision to use Pascal instead of cryptic “C“.”

SO for learning purposes what do you reckon of this pascal?

I learnt it as part of a computer science degree, its a good language to learn to program with, and unlike the C based languages , it makes some sense when you look at it years later :) . C was often criticised as a 'write only' language, because of its terse and cryptic nature.

Pascal is rarely used outside education unfortunately.........

Ah Turbo Pascal! :)

I recall using it first on a CP/M Kaypro Z-80 system and later on a PC. I think it really was one of the first to popularize the IDE concept? I think there is a Pascal front end that works with GCC?

Lefty

My two-coins-of-insignificant-value...

but the fact is, that in military or space projects, “C“ is prohibited

I guess the folks working on Pheonix didn't get the memo. C / Linux was apparently the choice.

only the Pascal related language ADA is allowed

I guess the folks working on the Rovers (Java / VxWorks) and the Space Shuttle (S/360 assembly; yeck!) didn't get the memo either.

SO for learning purposes what do you reckon of this pascal?

Nicholas Wirth's Pascal is, in my opinion, a bit too restrictive for embedded programming. There are times when being closer to the metal is necessary and the original Pascal keeps the programmer as far from the metal as possible.

A modern Pascal is functionally equivalent to C. Anything that can be done in Pascal can be done in C. A modern object-oriented Pascal is functionally similar to C++.

After working with both for decades, the decision comes done to a handful of features. If a preprocessor is important, then C++ is usually the better choice. If bit-sets are important, then Pascal is a better choice. If multiple-inheritance is important, then go with C++. If simplified interfaces are important, then go with Pascal. There are good numerical libraries, graphical libraries, database libraries, etcetera for both.

My personal preference is C++ for embedded programming. I like being able to put object-instances in static data, on the stack, or on the heap. In my opinion, portable C++ code is easier to develop than portable Pascal. I like having a good preprocessor when doing embedded work. I see no compelling reason to choose Pascal over C++ for the Arduino.

C was often criticised as a 'write only' language, because of its terse and cryptic nature.

If you want "write-only" then try LISP!

.andy

If you want "write-only" then try LISP!

(((W(h((a((t(e)v))e))r)) (c((o((u)l))d)) (y(o((u)) (m((e((a))n))?)))

Lefty

It's been many years since I used it (grad school), but I just got a very weird chill reading your LISP post, Lefty! It is a very beautiful language formally, but wow. I vaguely recall that you could write a solution to the Towers of Hanoi problem in about one line. CAR CDR indeed.

only the Pascal related language ADA is allowed

I don't think it's fair to call ADA "pascal related." Like many big $$ language developement efforts, ADA was something of a mashup of most of the languages around. Pascal probably someone less than AlgoL, ForTran, PL/1, and probably even CoBOL, give the buy-in they wanted form "serial software writers" rather than just universities.

There is a pascal for AVRs that I've hear reasonable reviews of, from MikroElectronica (?) http://www.mikroe.com/en/compilers/

Wirth-style pascal is a bit worthless for deeply embedded systems; it does too much that it disallows the code to do, rather intentionally. Most modern Pascals for micros have fixed these issues, I believe.

I don't think it's fair to call ADA "pascal related."

Very much so -- Ada was developed (extended) from the original model of Pascal in an attempt to make a language that could be used for more real-world applications than Pascal was suited for.

Ada was developed (extended) from the original model of Pascal

Wikipedia seems to agree with you, but I remember it feeling more like Ada was yet another attempt to merge all the best features of all the languages people were using into one. Not too different from IBM's attempt to make PL/1 replace both Fortran and Cobol (plus "academic" languages like Algol.)

Well, there was that tendency, as I recall. But it all came from ALGOL originally. I think. I'd have to go back to the long-ago boxed reference books to verify the chronology. Or just trust Wikipedia and look it up online :-)

In any event, programming languages of that class and era were very much aimed at the development of large, complex systems. Therefore verifiability and program correctness were driving goals for language design.

I guess these days, Java is filling that need.

.andy

programming languages of that class and era were very much aimed at the development of large, complex systems.

Hmm. Perhaps. By the standards of that timeframe. I keep being reminded that my kids’ computers have more RAM than the Mainframe I used in college had DISK space…

Therefore verifiability and program correctness were driving goals for language design.

They were part of the goals for Ada. I don’t think they succeeded, though (even in Ada; much less so in the real world of applications.)

Interesting: http://en.wikipedia.org/wiki/Timeline_of_programming_languages

but the fact is, that in military or space projects, “C“ is prohibited, only the Pascal related language ADA is allowed.

Absolutely false. There was an attempt to require this, many years ago, but it failed. One can argue that we'd be better off if it had succeeded, especially given the number of spectacular failures that have resulted from allowing the military to use Microsoft crapware in important systems. But it didn't, and I'm suspicious of anyone who doesn't know that, and who feels compelled to keep putting "C" in quotes. It suggests someone with an academic background and little real-world experience: professionals don't use quotes when referencing C any more than they do Pascal or COBOL.

There certainly would be some benefits to learning another language if you plan to do a lot of programming: as with learning more than one spoken language, it broadens the mind. Learning a more "academic" language like Pascal is useful because the compilers tend to nag you more about risky and sloppy programming practices, or even prohibit them. That encourages better coding habits. But modern C and C++ compilers can be told to be fussy, and can spot and warn you about many risky practices without trying to keep you from taking the risk if you choose to do so. So that advantage has diminished a lot.

My advice: if you plan to get serious about programming as a hobby, you should definitely plan on learning some other languages. Perhaps something like Python or Java that's useful for making things happen the way you want to on the PC side, for starters. If you're thinking about programming professionally, learning other languages is essential.

If you're just having fun tinkering with Arduinos as an occasional diversion, you shouldn't feel bad about sticking with the standard Arduino toolkit, and may even find it confusing to learn other languages if leads to trying to use techniques or syntax you learned in language "x" when you're coding in language "y".

It all depends on your goals and your interests, and what makes sense for other people may actually be counterproductive for you.

Ran

Ran

Not too different from IBM's attempt to make PL/1 replace both Fortran and Cobol

That was more an attempt to lock in customers by getting them to use a language that wasn't available in standardized form on competing machines.

At least at the management level: down in the trenches, I'm sure there were a lot of unhappy COBOL users who saw it as a matter of self-preservation against future suffering from Carpal Tunnel Syndrome ;D

Ran