GDCC: An Alternative ACS Compiler [0.15.0]

Any utility that assists in the creation of mods, assets, etc, go here.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.

Re: GDCC: An Alternative ACS Compiler

Postby Marrub » Sun Jan 04, 2015 1:40 pm

Can confirm GDCC has made working with modding 666% easier.
:D
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: GDCC: An Alternative ACS Compiler

Postby Nash » Sun Jan 04, 2015 3:52 pm

DavidPH wrote:So, more than a year passed. DH-acc grew in capabilities and was eventually used for stuff. But then it also grew into a monstrosity of conflicting design goals and had to be put down. Thus was born GDCC. First post has been updated to reflect the change. And this post is largely a bump to remind people that I am still crazy and still making compilers for ACS bytecode. :P (New features of GDCC are mentioned in the updated first post.)


Is the syntax still significantly different than regular ACC? The only reason I never got into DH-acc was because porting my project was going to be a nightmare. BCC's syntax was more attractive but it's only for Zandronum so I skipped that too.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sun Jan 04, 2015 4:50 pm

There are plans to write gdcc-acc after the C front is feature-complete. (Mostly waiting on completion of the libc implementation.)

In the meantime, porting from ACS to C may not be too difficult. The biggest immediate porting problem would probably be replacing #import with #include and headers. The printing syntax is different, being based around an __nprintf function that writes to the native print buffer. This is likely to be annoying, but it is at least a direct translation from ACS syntax. Any usage of global arrays would need to have declarations rewritten, but otherwise usage would mostly remain the same. The differences in function declaration are small, and mostly amount to removing the "function" identifier or making it inert with a macro. Most of the statements and local object declarations are the same, except that variables that need fixed-point types will need to be declared as such. The string and floating literals have slightly different meaning in C, but that can be controlled using pragmas.

Long story short: ACS is sort of a pared down C, so they should be reasonably similar. And porting should be reasonably practical if you are sufficiently familiar with both languages.

EDIT: Even shorter answer: GDCC's C is much closer to ACS than DH-acc's DS.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby Nash » Sun Jan 04, 2015 5:23 pm

Great, I'll take a look at it at some point and I'll bug you on IRC if I have any difficulties. :P
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Fri Jan 09, 2015 3:29 pm

Version 0.6.0 has been released! Download link is in first post. The goal of this version, was to achieve feature-parity with DH-acc. And while there are some omissions, recently completed porting of certain projects (thanks to marrub and TheMisterCat) has convinced me that it has sufficiently met that goal. Not much has changed in the last few days, as you might expect. But I did commit partial math.h and stdfix.h implementations. The former is missing error and gamma functions and the latter is missing arithmetic and strto functions.

I do not have specific plans for 0.7 goals currently. Not for lack of a massive pile in the TODO list, just not yet decided which to do first.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby Nash » Mon Jan 19, 2015 5:47 am

So when will you start working on gdcc-acc? I assume when GDCC 1.0 is done?

Also, please answer this to me like as if I'm a complete noob: Will gdcc-acc be easy or hard to transition to? Again, I will repeat what I said about BCC and why it would have been a no-brainer for me if it wasn't Zandronum exclusive: It was literally ACC with structs (and other impressive stuff). I didn't have to relearn anything. If gdcc-acc will be anything like BCC... then consider me a confirmed user. :D
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Mon Jan 19, 2015 6:01 am

The primary goal of gdcc-acc would be maximum compatibility with acc's ACS. In that sense it would be relatively easy to transition to. The secondary goal, however, would be to have extensions to ease porting to C. So in that that sense, it would probably be similar to what you describe bcc like.

As far as timing, gdcc-acc is one of the 1.0 goals, so it will be before that. Like I said, I'm mostly waiting for the C front to be sufficiently complete. The reason being that I expect to use stuff (technical programming term) from it for gdcc-acc. That said, cc-lib is probably stable enough already. The first step in gdcc-acc will be arriving at a formal specification for ACS. At the least, a formal grammar. If someone has something like that already, it would be greatly appreciated. I have concerns that I do not know all of ACS's dark corners.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Sat Feb 28, 2015 3:14 pm

The gdcc-acc branch has now been merged into master! So you can compile ACS code with GDCC. Which means for the first time, the title of this thread is literally true. Like gdcc-cc, gdcc-acc only outputs IR files and it uses different options, so it is not a drop-in replacement for acc. However, the language compatibility should be high. Known omissions are CreateTranslation and StrCpy. There are also some issues with str expressions not implicitly casting to int resulting in compile errors where acc would accept the code.

Currently the only specific extension over acc is a fixed type that can be enabled with #pragma FIXED_TYPE ON. Fixed-point literals can be made to have fixed type with #pragma FIXED_LITERAL ON. Both can be enabled at once with #pragma FIXED ON. Without those on, the behavior should be the same as in acc. Other extensions are planned (some already implemented by happenstance), but the priority for the ACS front right now is documentation and improving acc compatibility.

Programs compiled with gdcc-acc implicitly depend on libGDCC. Currently, you can generally get away with not linking in libGDCC, but I make no specific promises about that in the future.

Not specific to the ACS front, but I have also added a --sys-source option which specifies a file relative the the system lib/src directory. So instead of /usr/share/gdcc/lib/src/libc/math.c (or the executable path in Windows) you can say --sys-source libc/math.c. This option is available in gdcc-acc, gdcc-as, and gdcc-cc.
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby DavidPH » Tue Mar 17, 2015 6:35 pm

Added struct declarations to gdcc-acc. Syntax is mostly the same as C:
Code: Select allExpand view
struct AwesomeType
{
   int a, b, c;
   fixed x, y, z;
   str s; // Always got to have that wrench in the works.
}

AwesomeType someArray[100000]; // Everyone Loves Memory Excess

global AwesomeType 10:superArray[];

function AwesomeType LetsGetFuncy(AwesomeType bestParameter)
{
   ++bestParameter.a;
   return bestParameter;
}
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: GDCC: An Alternative ACS Compiler

Postby Nash » Wed Mar 18, 2015 12:30 pm

Why do I feel that this was made out of pressure from me... XD XD XD
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: GDCC: An Alternative ACS Compiler

Postby oODemonologistOo » Thu Mar 19, 2015 2:44 am

I can't get this to work properly using batch files. Anyone has one that's ready to use?
User avatar
oODemonologistOo
undecided
 
Joined: 17 Jul 2007
Location: one of the labs of hell

Re: GDCC: An Alternative ACS Compiler

Postby Marrub » Thu Mar 19, 2015 7:40 am

oODemonologistOo wrote:I can't get this to work properly using batch files. Anyone has one that's ready to use?

Here's a project-agnostic batch file I made to compile for GDCC-CC.
http://pastebin.com/Rkb9KDhN
Implied directory tree:
src/ - .c files
inc/ - .h files
GDCC/ - GDCC itself
acs/ - linker output
bin/ - intermediate files
bin/libgdcc - libGDCC/libc intermediate files
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: GDCC: An Alternative ACS Compiler

Postby Nash » Thu Mar 19, 2015 1:39 pm

^ where to put the PK3/WAD content? Also can you make one for GDCC-ACC? pl0x? :D
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: GDCC: An Alternative ACS Compiler

Postby Marrub » Thu Mar 19, 2015 7:58 pm

Nash wrote:^ where to put the PK3/WAD content? Also can you make one for GDCC-ACC? pl0x? :D

It's supposed to be put into the PK3, like so:
Spoiler:

Just change the "CC" variable to gdcc-acc.
User avatar
Marrub
Xevv Va Rkvyr
 
 
 
Joined: 26 Feb 2013
Operating System: Other Linux 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: GDCC: An Alternative ACS Compiler

Postby oODemonologistOo » Fri Mar 20, 2015 1:45 am

I'm still a bit puzzled as to how to use this tool. I tried using the batch file and I get lots of "unrecognized command" errors on the "gdcc-cc". Can you elaborate on the process a bit more?
User avatar
oODemonologistOo
undecided
 
Joined: 17 Jul 2007
Location: one of the labs of hell

PreviousNext

Return to Editors / Asset Manipulation

Who is online

Users browsing this forum: King_Epitaph and 1 guest