# Started Pascal target :)

**URL:** https://community.haxe.org/t/started-pascal-target/1653
**Category:** Haxe
**Created:** [April 3, 2019, 5:01pm UTC](https://community.haxe.org/t/started-pascal-target/1653 "2019-04-03T17:01:40Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 3, 2019, 5:01pm UTC](https://community.haxe.org/t/started-pascal-target/1653/1 "2019-04-03T17:01:40Z")

</div>

Bloody hell this feels good…

 ![Capture](https://community.haxe.org/uploads/default/original/1X/bb1492dace4eb3613724e9ef1083c9f189295840.png)

---

<div class="post-metadata">

### Author: ![mark.knol](https://community.haxe.org/user_avatar/community.haxe.org/mark.knol/32/50_2.png) [@mark.knol](https://community.haxe.org/u/mark.knol)
#### Post date: [April 3, 2019, 5:19pm UTC](https://community.haxe.org/t/started-pascal-target/1653/2 "2019-04-03T17:19:47Z")

</div>

Dang! 🔥

Looking at your previous posts, this seems accurate 😄  
 ![image](https://community.haxe.org/uploads/default/original/1X/9eddc0240ae7176eab30fcc2150dd8ae256f82d4.png)

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 3, 2019, 5:36pm UTC](https://community.haxe.org/t/started-pascal-target/1653/3 "2019-04-03T17:36:07Z")

</div>

Accurater:

![9eddc0240ae7176eab30fcc2150dd8ae256f82d4](https://community.haxe.org/uploads/default/original/1X/068f2003d47800da20aecd693a8b26b85f9897da.png)

---

<div class="post-metadata">

### Author: ![sundialservices](https://avatars.discourse-cdn.com/v2/letter/s/9e8a1a/32.png) [@sundialservices](https://community.haxe.org/u/sundialservices)
#### Post date: [April 3, 2019, 9:50pm UTC](https://community.haxe.org/t/started-pascal-target/1653/4 "2019-04-03T21:50:04Z")

</div>

But unfortunately, _“there’s always one more bug.”_ 💀

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 3, 2019, 9:59pm UTC](https://community.haxe.org/t/started-pascal-target/1653/5 "2019-04-03T21:59:02Z")

</div>

> [@sundialservices](#):
>
> _“there’s always one more bug.”_ 💀

![roads-where-were-going-we-dont-need-roads-13712975](https://community.haxe.org/uploads/default/original/1X/450c070f78f4e9ea2ed9992abfcea4f0a250f32a.png)

---

<div class="post-metadata">

### Author: ![elsassph](https://community.haxe.org/user_avatar/community.haxe.org/elsassph/32/60_2.png) [@elsassph](https://community.haxe.org/u/elsassph)
#### Post date: [April 4, 2019, 1:12pm UTC](https://community.haxe.org/t/started-pascal-target/1653/6 "2019-04-04T13:12:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 4, 2019, 2:05pm UTC](https://community.haxe.org/t/started-pascal-target/1653/7 "2019-04-04T14:05:48Z")

</div>

> [@elsassph](#):
>
> Is there a practical benefit from using the Pascal target?

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++.

> [@elsassph](#):
>
> Build times/SDK size maybe?

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.

- Lazarus: [https://www.lazarus-ide.org/](https://www.lazarus-ide.org/)
- FreePascal: [https://freepascal.org/](https://freepascal.org/)

---

<div class="post-metadata">

### Author: ![elsassph](https://community.haxe.org/user_avatar/community.haxe.org/elsassph/32/60_2.png) [@elsassph](https://community.haxe.org/u/elsassph)
#### Post date: [April 4, 2019, 2:14pm UTC](https://community.haxe.org/t/started-pascal-target/1653/8 "2019-04-04T14:14:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 4, 2019, 2:56pm UTC](https://community.haxe.org/t/started-pascal-target/1653/9 "2019-04-04T14:56:25Z")

</div>

> [@elsassph](#):
>
> maybe making lightweight, fast to compile, and performant standalone CLI apps?

Most certainly 🙂  
The FreePascal compiler is excellent for that.

> [@elsassph](#):
>
> I don’t assume leveraging the GUI would be that easy.

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.

---

<div class="post-metadata">

### Author: ![elsassph](https://community.haxe.org/user_avatar/community.haxe.org/elsassph/32/60_2.png) [@elsassph](https://community.haxe.org/u/elsassph)
#### Post date: [April 4, 2019, 3:56pm UTC](https://community.haxe.org/t/started-pascal-target/1653/10 "2019-04-04T15:56:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 4, 2019, 6:02pm UTC](https://community.haxe.org/t/started-pascal-target/1653/11 "2019-04-04T18:02:59Z")

</div>

> [@elsassph](#):
>
> 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.

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…

---

<div class="post-metadata">

### Author: ![sundialservices](https://avatars.discourse-cdn.com/v2/letter/s/9e8a1a/32.png) [@sundialservices](https://community.haxe.org/u/sundialservices)
#### Post date: [April 4, 2019, 6:40pm UTC](https://community.haxe.org/t/started-pascal-target/1653/12 "2019-04-04T18:40:28Z")

</div>

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?”

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 4, 2019, 6:54pm UTC](https://community.haxe.org/t/started-pascal-target/1653/13 "2019-04-04T18:54:05Z")

</div>

> [@sundialservices](#):
>
> 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.

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

> [@sundialservices](#):
>
> Hence, "why Pascal in particular?"

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?

---

<div class="post-metadata">

### Author: ![itzikiap](https://community.haxe.org/user_avatar/community.haxe.org/itzikiap/32/74_2.png) [@itzikiap](https://community.haxe.org/u/itzikiap)
#### Post date: [April 4, 2019, 8:22pm UTC](https://community.haxe.org/t/started-pascal-target/1653/14 "2019-04-04T20:22:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fullofcaffeine](https://community.haxe.org/user_avatar/community.haxe.org/fullofcaffeine/32/28_2.png) [@fullofcaffeine](https://community.haxe.org/u/fullofcaffeine)
#### Post date: [April 4, 2019, 8:41pm UTC](https://community.haxe.org/t/started-pascal-target/1653/15 "2019-04-04T20:41:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 4, 2019, 9:34pm UTC](https://community.haxe.org/t/started-pascal-target/1653/16 "2019-04-04T21:34:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mark.knol](https://community.haxe.org/user_avatar/community.haxe.org/mark.knol/32/50_2.png) [@mark.knol](https://community.haxe.org/u/mark.knol)
#### Post date: [April 5, 2019, 10:25am UTC](https://community.haxe.org/t/started-pascal-target/1653/17 "2019-04-05T10:25:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Matt](https://avatars.discourse-cdn.com/v2/letter/m/a6a055/32.png) [@Matt](https://community.haxe.org/u/Matt)
#### Post date: [April 5, 2019, 10:30am UTC](https://community.haxe.org/t/started-pascal-target/1653/18 "2019-04-05T10:30:29Z")

</div>

> [@sundialservices](#):
>
> I guess that I’m scratching my head a little bit about _this_ choice of targets,

Which target would you suggest instead?

---

<div class="post-metadata">

### Author: ![andyli](https://community.haxe.org/user_avatar/community.haxe.org/andyli/32/26_2.png) [@andyli](https://community.haxe.org/u/andyli)
#### Post date: [April 5, 2019, 11:45am UTC](https://community.haxe.org/t/started-pascal-target/1653/19 "2019-04-05T11:45:29Z")

</div>

> [@Matt](#):
>
> It all seems so pointless now.  
> Nobody will use this, ever.

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](https://github.com/HaxeFoundation/haxe/issues) 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).

---

<div class="post-metadata">

### Author: ![ibilon](https://community.haxe.org/user_avatar/community.haxe.org/ibilon/32/13_2.png) [@ibilon](https://community.haxe.org/u/ibilon)
#### Post date: [April 5, 2019, 11:52am UTC](https://community.haxe.org/t/started-pascal-target/1653/20 "2019-04-05T11:52:03Z")

</div>

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 😉 good luck!

[Next page](https://community.haxe.org/t/started-pascal-target/1653.md?page=2)
