Relax, a compiled programming language, implemented entirely in AHK

Post your working scripts, libraries and tools for AHK v1.1 and older
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 06:32

Delta Pythagorean wrote:
05 Feb 2020, 05:49
So...
Is this just a way to create dll files/library executables using ahk? Or am I reading the documentation wrong?
Technically, yes, that's all it really is (I didn't actually implement building DLL files though).

Except that majorly undersells it. It generates the code which goes inside the executables, which is much more of an accomplishment in my opinion. It generates every single byte that will be in the final file, all from a relatively high level (compared to assembly and machine code) source language.

Think of it like a very dumbed down version of GCC -or which C compiler you use- except that it takes a different language for input.
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 06:35

SOTE wrote:
05 Feb 2020, 05:58
The documentation you have created, https://cloakersmoker.github.io/Relax-Language/#how-it-works/, is a good read. Especially as cooked up as a sleepless experiment.
Thanks, I wanted to make sure I expressed my exhaustion enough that it would be understandable why some things are a bit half-baked. I'm glad you liked it.
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 06:38

rommmcek wrote:
05 Feb 2020, 06:17
I tried new version quickly on Win10 and it seems to show no changes, i.e. running Main.exe yields no output and output from Main.ahk can't be run on my PC.
P.s.: Is Main.exe on GitHub identical with that compiled on PC or is it a separate version?
I really don't know what the problem would be then, could you give some general system specs like CPU and motherboard? I'd only use it to check if I'm using any features which is disabled on certain hardware.

And yes, Main.exe is nearly exactly the same as a compiled version of Main.ahk. The only difference is that Main.exe has a single byte set to 3 instead of 2 in the headers, which makes it run as a console application.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 07:09

CloakerSmoker wrote:
05 Feb 2020, 06:32
Delta Pythagorean wrote:
05 Feb 2020, 05:49
So...
Is this just a way to create dll files/library executables using ahk? Or am I reading the documentation wrong?
Technically, yes, that's all it really is (I didn't actually implement building DLL files though).

Except that majorly undersells it. It generates the code which goes inside the executables, which is much more of an accomplishment in my opinion. It generates every single byte that will be in the final file, all from a relatively high level (compared to assembly and machine code) source language.

Think of it like a very dumbed down version of GCC -or which C compiler you use- except that it takes a different language for input.
I do think Delta's comment about using Relax to make DLLs does have merit. As Relax has a AutoHotkey connection, it makes sense that AHK users would want to create DLLs from it to be used in their projects, which could be AutoHotkey based or involving a different language. The difference from using AutoHotkey.dll, could be that it would be smaller, have more specific code, or have more customized functions.

In addition, (somewhere down the line) Relax might be able to open up the possibilities of creating executables or .so files (Linux equivalent of a Windows DLL) for different OSes (cross-compiling), as it's a kind of AHK based customizable compiler.
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 08:20

SOTE wrote:
05 Feb 2020, 07:09
I do think Delta's comment about using Relax to make DLLs does have merit. As Relax has a AutoHotkey connection, it makes sense that AHK users would want to create DLLs from it to be used in their projects, which could be AutoHotkey based or involving a different language. The difference from using AutoHotkey.dll, could be that it would be smaller, have more specific code, or have more customized functions.

In addition, (somewhere down the line) Relax might be able to open up the possibilities of creating executables or .so files (Linux equivalent of a Windows DLL) for different OSes (cross-compiling), as it's a kind of AHK based customizable compiler.
As much as I'd like to build DLL files, it would need a new syntax to export functions, and I'd need to alter PEBuilder (which was the most painful part of the project), so it probably won't be added.
Although, there is the ".ahk" output file type, which will compile a program into a group of AHK functions, which is my attempt at having similar functionality to C MCode.

And for making elf or so files, I'd want to bootstrap the compiler first (aka have a version of the compiler implemented in Relax itself) so I'd have a version which can run on Linux too.

But realistically, none of these features are likely to be added. I like the language I've built, and love how much I've learned; but I'm also super burnt out. So, I'll probably fix any problems that get found in the next week or two, then release version 1.0 and put Relax on the back burner for a bit.

There's a chance I'll come back and actively work on Relax in the future, but that's only if it gets used, since adding features to this version of Relax would take effort I'd much rather put into something else. The language definitely isn't being abandoned though, and I do plan to bring it up to C in terms of features eventually (Although I'll probably implement it in a language other than AHK).
burque505
Posts: 1736
Joined: 22 Jan 2017, 19:37

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 09:10

Just followed the instructions to delete the pre-compiled files on Win10, recompiled both examples, they worked!
On Win7, I did the same - now, in addition to the non-valid program MessageBox, I got an "access denied" message. Maybe that's a clue.
Regards,
burque505
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 09:32

CloakerSmoker wrote:
05 Feb 2020, 08:20
I do plan to bring it up to C in terms of features eventually (Although I'll probably implement it in a language other than AHK).
I kind of hope you keep it in the AHK language, just for the sheer coolness and community helpfulness of if. But great project, no matter which direction you decide.
bourdin07
Posts: 36
Joined: 23 Jun 2019, 12:57

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 09:42

oh man, this is incredible.

does it fully support C language??

the syntax seem very clear
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:03

CloakerSmoker wrote:
05 Feb 2020, 06:38
..., could you give some general system specs like CPU and motherboard? I'd only use it to check if I'm using any features which is disabled on certain hardware.
some processor's data
Can you help me where can I find motherborad's data?
P.s.: If I compile Main.ahk the Main.exe (appended) does nothing.
P.p.s.: Is it possible to edit (in hex editor) compiled Main.exe (once it works) so it would be a consol app and how (which bite)?
Attachments
Main.zip
(573.68 KiB) Downloaded 103 times
Last edited by rommmcek on 05 Feb 2020, 10:05, edited 1 time in total.
burbigo1
Posts: 2
Joined: 05 Feb 2020, 09:59

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:04

Thanks a lot for the instructions !
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:18

SOTE wrote:
05 Feb 2020, 09:32
I kind of hope you keep it in the AHK language, just for the sheer coolness and community helpfulness of if. But great project, no matter which direction you decide.
I really wish I could, but I feel like I'm really tying myself down by using AHK as my primary language, and want to switch to a "real" language.

With all the interest though, I'll probably keep the AHK version going too. I just need a bit of a break before I continue.
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:28

bourdin07 wrote:
05 Feb 2020, 09:42
oh man, this is incredible.

does it fully support C language??

the syntax seem very clear
It's not really a C compiler, if you read over this (https://cloakersmoker.github.io/Relax-Language/#basic-syntax/) docs page, it explains the differences between Relax and C.

Mostly, C has more features, but you generally write code the say way you would in C (Ex: manually freeing memory, managing pointers).
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:43

rommmcek wrote:
05 Feb 2020, 10:03
P.s.: If I compile Main.ahk the Main.exe (appended) does nothing.
P.p.s.: Is it possible to edit (in hex editor) compiled Main.exe (once it works) so it would be a consol app and how (which bite)?
I've looked at that processor, and I don't notice anything odd, so I'll need to keep looking.

And I'm not sure why compiling Main.ahk wouldn't do anything, but that sounds like an AHK problem.

If you go to byte 0x16C in Main.exe and change it from 2 to 3, it'll change to the console subsystem.
That offset isn't constant though, and doesn't apply for all exe files.
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:44

burbigo1 wrote:
05 Feb 2020, 10:04
Thanks a lot for the instructions !
🤝
burque505
Posts: 1736
Joined: 22 Jan 2017, 19:37

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 10:44

@CloakerSmoker, for Win10, I have the same issue and questions as @rommmcek:
P.s.: If I compile Main.ahk the Main.exe (appended) does nothing.
P.p.s.: Is it possible to edit (in hex editor) compiled Main.exe (once it works) so it would be a consol app and how (which bite)?
Thanks for all your work on this, this is great.
Regards,
burque505
CloakerSmoker
Posts: 33
Joined: 07 Sep 2018, 15:54

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 11:05

@burque505 @rommmcek

I really am stumped, but it's worth checking the properties for "out.exe" and making sure it's not blocked, along with checking that you have read+execute permissions for it.
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Relax, a compiled programming language, implemented entirely in AHK

05 Feb 2020, 12:14

Setting byte 0x16C to 03 makes compiled (with Ahk Compiler) Main.exe working. Sadly it doesn't yield any output neither. I'll check properties & permissions later.

Btw.: Thanks for your support and actually in the first place Thank You for Relax overall!!!
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Relax, a compiled programming language, implemented entirely in AHK

08 Feb 2020, 13:29

If main.ahk is executed from:
- Explorer (double clikck): works as expected
- Run (Win+R): works as expected
- Command line (Cmd): works as expected
- SciTE4AutoHotkey via Quick run (Ctrl+Shift+F5): works as expected

- AHK Studio (Alt+R): does nothing (just opens Cmd and closes it)
- AutoGUI v2.6.2 (F9): does nothing (just opens Cmd and waits for Enter, ^c or closing Cmd)
- SciTE4AutoHotkey via Run (F5) [Edited Copy/Paste-Typo]: does nothing and Output yields: >"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "E:\Relax1\Main.ahk"
>Exit code: 1 Time: 0.4495


If Relax uses internally some kind of analogous principle to call StdOut (sorry for amateurish terminology) it might be kind of clue and would explain why compiled Main.exe does nothing (until it is converted manually to console app).

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: silelunu and 164 guests