COMMUNITY

Started Pascal target :)

#1

Bloody hell this feels good…

8 Likes

(Mark) #2

Dang! :fire:

Looking at your previous posts, this seems accurate :smile:
image

1 Like

#3

Accurater:

9eddc0240ae7176eab30fcc2150dd8ae256f82d4

1 Like

(Mike Robinson) #4

But unfortunately, “there’s always one more bug.” :skull:

1 Like

#5

roads-where-were-going-we-dont-need-roads-13712975

0 Likes

(Philippe) #6

Is there a practical benefit from using the Pascal target?
Build times/SDK size maybe?

0 Likes

#7

For most people there won’t really be.

However, the FreePascal compiler is a very capable compiler, targeting a plethora of 64-, 32- and even 16-bit processor architectures:

  • Intel x86 (including 8086),
  • AMD64/x86-64,
  • PowerPC,
  • PowerPC64,
  • SPARC,
  • ARM,
  • AArch64,
  • MIPS,
  • JVM, and
  • Motorola 68k

and operating systems:

  • Linux,
  • FreeBSD,
  • Haiku,
  • Mac OS X / iOS / iPhoneSimulator / Darwin,
  • DOS (16 and 32 bit),
  • Win32,
  • Win64,
  • WinCE,
  • OS/2,
  • MorphOS,
  • Nintendo GBA,
  • Nintendo DS,
  • Nintendo Wii,
  • Android,
  • AIX,
  • AROS.

For all of these there will probably be C++ compilers available as well (I mean, for which OS / CPU isn’t there?).

But some old cranky folks like me might prefer the readability of good ole’ Pascal over the gobbledegook that is C++.

The compiler is indeed fast, it produces fast code (speeds on par with C / C++), and executable sizes are small, because of various optimisations (provided configured correctly).

Another benefit (at least for me) is the existence of the fantastic Lazarus Project:

Lazarus is an environment, IDE, library, etc, that provides everything you need to very quickly write GUI applications, most typically desktop apps running on Linux, Mac, Windows (but other targets are possible as well, such as Android).

It is ridiculously easy to whip up a GUI’ed application, design forms and dialogs, etc, in a matter of minutes.

The LCL, the Lazarus Component Library, provides all the usual suspects: buttons, menus, labels, edit boxes, memos, sliders, check boxes, radio groups, tree views, list views, standard dialogs like file open & save, select directory / font / colour / printer, etc.

0 Likes

(Philippe) #8

Thanks I’m familiar with all that, just very practically what could be a good use case - maybe making lightweight, fast to compile, and performant standalone CLI apps? I don’t assume leveraging the GUI would be that easy.

2 Likes

#9

Most certainly :slight_smile:
The FreePascal compiler is excellent for that.

Not sure yet, but I imagine it could be made to work that way, given the power of Haxe macros etc.
E.g., the source for a very simple GUI executable, with just a main form and some simple controls, can consist of as little as 4 text files:

  • The project’s *.lpi file, which contains information about what files are in the project, required packages, etc,
  • The *.lpr file, which is the main program source code,
  • The form’s *.pas file, containing the source code that accompanies the form, and
  • The form’s *.lfm file, containing the form’s layout.

This, and some command line switches, is all the compiler needs to compile the executable.

Everything else (such as e.g. the resource file for a program icon) is optional.

0 Likes

(Philippe) #10

I did quite a bit of Delphi in my youth so I have sympathy for the idea - using the layout builder is one of the cool things of the RAD.

3 Likes

#11

Indeed, and current Lazarus is so much better than the Delphi that I knew (last: Delphi 7) ever was:
In a recent job, I had to work with a Delphi 7 codebase…
Huge codebase, some 400 Delphi projects that were supposed to work together…

Anyway, coming from the excellent, modern Lazarus IDE, working in D7 was a real PITA!
So many handy IDE features that Lazarus has but D7 lacked, OMG!

In the meantime, in other news:

I’m staring at this OCaml codebase, and I have NO idea where to go from here…
OCaml is so weird, so inside-out…
I don’t know where to start, really…

0 Likes

(Mike Robinson) #12

I guess that I’m scratching my head a little bit about this choice of targets, because Pascal is also a strongly-typed language … with many, many flavors that have nothing to do with Wirth’s Pascal User Manual and Report. (Yes, I remember it, and I have a copy.) I’m skeptical about the actual value of it.

And after all, if you consider (say) the overall architecture of the gcc compiler-suite, “the source-code language is almost an afterthought.” Everything gets converted into ASTs and then quickly into an intermediate representation that is very consistent among every one of the many different languages that gcc now supports. And, really, that’s what we are ultimately trying to get to. Most multi-language compiler suites work in precisely the same way: they go from the specific to the fairly-generic, and work the back end from there. Hence, “why Pascal in particular?”

0 Likes

#13

Maybe I better stop then.
I’m not getting anywhere anyway.
I’m too stupid, and the code is almost completely undocumented.

Maybe I just wanted to become a useful contributor to the Haxe compiler project in any way I could, and implementing a target, I probably wrongly assumed, was a good way to start, to get to understand the whole thing?

0 Likes

(Itzik Arzoni) #14

Listen man, I don’t have anything in particular to add to the conversation, but in my opinion working on a Pascal target for haxe is brilliant!
I mean, I’m not going to do anything with it, my days with Pascal ended with Turbo Pascal 7, and I loved it back than. But your enthusiasm about it is really worth a lot. By the time you will finish with Pascal, you might end up with just a half baked proof of concept, but by then you can just go in and improve the compiler itself, because you’ll already know it inside and out. You might also end up with a working Pascal target, who knows

3 Likes

(Marcelo Serpa) #15

I think a Lazarus-compatible Freepascal target would be awesome. Leveraging the UI capabilities of Lazarus would add a lot of value to the Haxe eco-system, in my opinion.

Maybe I better stop then.
I’m not getting anywhere anyway.
I’m too stupid, and the code is almost completely undocumented.

Programming a compiler is not an easy feat, but with focus and failing fast and often and learning from the mistakes, you can do it. The key here I think is to think of it in terms of small experiments/prototypes.

Forget perfection, it can’t be attained.

Forget style/aesthetics, it can always be improved later.

Learn to accept failure as a way to learn and get feedback, correct course, pivot, etc and not as an inherently negative thing.

Divide in manageable specific outcomes and and Focus on getting something working towards them. This process is often quite organic and you’ll find yourself correcting the route quite often, and that’s fine. It’s a creative process and it’s a bit chaotic at first.

Again, don’t try to create something perfect, and don’t worry about code aesthetics, nobody will judge you (I won’t, and if someone does, just give two f***s and carry on) within the community, on the contrary, they will be glad you’re taking the leap to help and might even jump in to help later.

0 Likes

#16

It all seems so pointless now.
Nobody will use this, ever.
Why would they?
And as I said: I suck as a developer.
I've been programming since I was little (about 50 years ago).
First thing I made was TRON on a ZX Spectrum, in Assembly.
It worked, and boy was it fast…
Since then I've been trying and failing at everything programming related.
I've been stuck in Delphi land, and on Windows, for a long time since then, and it's been my downfall.
I don't know Linux, and that makes me a pariah.
I feel a fool for not knowing bash, or Vim, or Emacs.
I'm completely out of touch with the reality of "cool" developers, I should just quit now, and that's what I'm doing:
I quit.

0 Likes

(Mark) #17

Man, don’t be so harsh on yourself. It seems you have super high expectations from yourself. Just doodle around to see where you can get. This all is not about being cool / smart, but just see it as exercise to learn something new and try to enjoy the process. I know it’s hard to keep up with everything, but fairly I think everyone struggles with that. I do too and I know that sometimes suggests me everything seems pointless. But that’s not true. So far you already did some stuff, so you progressed. Also, there are not much people who dare to try to get the compiler running anyway, and it is complicated stuff (well maybe not for those who work with it for years, but you shouldnt compare yourself with them anyway) Look at the stuff you can do, not what you seemly think you can not. In the end, when you look back, you will notice you did things you never realized you could ever do.

5 Likes

#18

Which target would you suggest instead?

0 Likes

(Andy Li) #19

Maybe no body would use it, but why care?
Programming can be for fun. If you think a Pascal target would be awesome, go for it.
But of course, if you lose interest already (or when you do one day), just do something else.
As long as you’re not trying to get paid or something.

If you want to do something useful to others, there are plenty of things to do other than writing a new target.
There are 855 open issues in our repo at the moment for you to fix.
Or you can write something, maybe a library, or some tools, or a tutorial, or another game (I like playing Haxe games).

3 Likes

(Valentin Lemière) #20

I do recommand you try some ocaml before doing the target, or some other compiler work.

Understanding the type system, how to do (recursive) function and call them, making/looping on lists, counting stuff, finding what the keywords means.

Then you’ll have a lot less things to worry about when using it :wink: good luck!

1 Like