0

My question is simple: there is any Pascal or Pascal-class (FPC, Delphi, mikroPascal) programming language for Arduino?

Preferably (I hope I don't ask too much) that language should not be older than 10 years.


Update:
Let's not start a flame war about "why the xxx programming language is so much better Pascal" and keep focus on the core of this question. I know that Pascal has it flaws (nothing its perfect, right?). I accept them and I still want to use it :)
Many thanks.

  • 1
    Because the usual Arduino environment is based on C++ you'd be best searching on "Pascal for AVR" which is the microcontroller used and it looks like there's a few options. – PeterJ Mar 12 '16 at 11:23
  • @PeterJ-Thanks. It seems I might have a chance to find some non-experimental or at least stable-enough Pascal language for Arduino – Kenny Mar 12 '16 at 11:35
  • 1
    Perhaps Mikroelektronika has some compiler based on Pascal. – Marko Buršič Mar 12 '16 at 11:43
  • 1
    Why do you want to? Arguably, C++ is "Pascal-like". I used to program in Pascal heavily, and moved to C/C++ when it became obvious that most serious programming was done in those languages. – Nick Gammon Mar 12 '16 at 20:34
  • 1
    @Kenny How about you contributing with something? A quote, some code, testing to use what is available in main-stream, etc. So far I think you have not made any friends around here. There are many reasons for why Pascal has left main stream development and why most embedded development use C/C++. We are a few that are trying to help you change focus. Obviously you can continue to look for an Arduino Pascal but it will be hard to find supporting libraries, drivers, etc. Please see the bigger picture - live in the now :) :) :) – Mikael Patel Mar 14 '16 at 13:43
4

Not Pascal, but Ada, which is much less restrictive than Pascal while enjoying the same advantages over low-level programming, and much more actively supported with language revisions as recently as 2012 and the formally provable SPARK language, for when you need your code to work.

Any processor which gcc supports can potentially support Ada, whose Gnat compiler is fully part of gcc.

That's not the whole story because you also need run-time system support for Ada's facilities, but for the Arduino's AVR processor there is a well established environment in the form of the AVR-Ada project.

It generates nice tight little executables, you'll be amazed how much less space simple Gnat executables take compared to Arduino ones - unless you've already made the same comparison between Arduino and C ... which after all uses the same gcc compiler.

For ARM-based Arduinos (Arduino Due at least) the same is possible, though the support is newer and possibly less well established, see the Cortex-GNAT project.

Leaving the Arduino, Ada has also been demonstrated on the MSP430 processor - my own project, sadly neglected at the moment.

  • 2
    Read your own question. You SPECIFICALLY asked about "... or Pascal-like languages". How amazing can Ada can be? the best way to find out is learn. You can use a Pascal-like subset and ignore the advanced features if you like; some of them are inappropriate for MCUs anyway. And re: language revisions, the latest standard for Pascal seems to be ISO7185:1990, perhaps you are confusing compiler revisions with language standards? Of course Gnat is updated much more often than the language itself. – Brian Drummond Mar 12 '16 at 22:44
  • Clarifications: 1. I am talking about Pascal derivatives (mikroPascal, FPC, Delphi, etc). 2. I am talking about the 'thing' that you install and use in your computer not about ISO. When I will do the program for Arduino I will use a real piece of software (hopefully Pascal) not an ISO. – WeGoToMars Mar 13 '16 at 21:56
  • I'm OK with you not "accept"ing it, btw. One or two of the comments pointed at possible alternative leads : if you follow up and they turn out to be useful, you can always add your own answer. Alternatively there used to be some sort of Pa front end for gcc. So if you feel strongly about Pascal, why not try building that for the AVR back-end, in which case the AVR-Ada project (runtime system) and my MSP430-Ada documentation may provide useful clues about some of the steps on that path. (Working on gcc is not trivial!) Good luck... – Brian Drummond Mar 13 '16 at 22:24
  • Anyway, until somebody will provide a different answer (if ever), Ada is indeed the closest thing to Pascal. I will accept your answer is no better alternative is provided. Thanks anyway. Upvoted. – WeGoToMars Mar 14 '16 at 9:24
  • 1
    @Kenny I hear you on obsolete criticisms of Pascal. Ada suffers from the same irrational reluctance to consider it and that affected me for years. I started programming in Wirth's first big language (Algol-W), also used Turbo Pascal (fantastic for its era) then his third (Modula-2 - great but with its limits). Then C and C++ for a decade or so thanks to their commercial inevitability, despite their design insanities. Looking for a saner alternative, tried Ada (not previously available). After C++, felt more like healing than learning. Not a recommendation, just a story of a journey. – Brian Drummond Mar 14 '16 at 11:44
1

Is it possible to program Arduino in Pascal?

The answer is yes and no. The answer is yes because it is possible to port the p-code virtual machine to Arduino and compile for that.

The answer is no if extending the question with "is there a supported open-source Arduino/AVR IDE for Pascal available?"

There are a few commercial AVR/Pascal products. You can easily web-search them.

Last, a possible short-cut is to use p2c, a Pascal to C translator, as a pre-processor in the Arduino IDE. There are hooks in the Arduino build for adding additional tools.

Cheers!

  • Thanks @MikaelPatel. Honestly, I don't mind paying (up to) 100 bucks for a Pascal commercial tool. I pay one order of magnitude more for my Delphi license so, 100 is not that much. P2C seems a decent alternative. I will consider P2C versus Ada (as recommended by Brian). Upvote (but I will keep Brian's post a the answer for the moment). Many thanks again. – WeGoToMars Mar 15 '16 at 13:15
1

A Pascal front-end to the Gnu compiler collection (gcc, on which nearly all the of AVR programming is based) already exists. Therefore, a Pascal compiler for AVR exists in principle if not in fact (and I don't know that it doesn't). I'd start by getting in touch with the folks working on the GPC to find out what has already been done.

0

There's also pascal p5c at sourceforge --> https://sourceforge.net/projects/pascal-p5c/

It uses gnu c as intermediate code so should work on any platform where gcc is available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.