Author Topic: HACC  (Read 24206 times)

0 Members and 2 Guests are viewing this topic.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #75 on: August 31, 2007, 04:17:00 pm »
Well labels aren't hard. They are arbituary. They translate directly into assembly. E.g.

... C code
goto A
... C code
A:

translates to

... translated C code
jp LA
... translated C code
LA:

I like your suggestions though. Keep them coming!
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline JincS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +0/-0
    • View Profile
HACC
« Reply #76 on: August 31, 2007, 08:11:00 pm »
Halifax: Any support for namespaces? Namespaces + structures + functions = possibility for OOP using ANSI C...

BTW, The assembler hasn't been worked on since the beginning of July->I got that roofing job, so I've been working 6-70 hours a week (6 days a week, which is why I really haven't been active all summer :(sad.gif ). I'm hoping to find some time to finish/optimize it sometime soon, but I really can't say when it'll get done.

Xlibman: A node is like a leaf on a tree->it's at the end of a tree branch :)smile.gif

**EDIT**

Halifax: Which algorithm are you using for your tree sorting/searching? I haven't seen your source in quite some time...*hinthintwinkpokenudge*

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
HACC
« Reply #77 on: September 01, 2007, 02:34:00 am »
aaah i see jincs, thanks :)smile.gif

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #78 on: September 01, 2007, 08:08:00 am »
JincS: Corrention: A node is a leaf or branch. I node is a very ambiguous word kind of like int. There is a 'short int' and 'long int' just as there is a 'branch node' and 'leaf node' with a tree. Once I get timing implemented into my tree I am going to post a more complicated example with a given tree and simplifying.

Also JincS you haven't seen the code since you only stop by the channel for 1 minute at the most and then leave ;)wink.gif. I am there almost everytime you do that, but I am working on HACC which takes up the full screen. If you message me it will make a sound and then I will know your there.

And to answer your other question. The generic trees are built specifically to be generic to Hacc not generic trees in general lol. That means that there is no sorting or searching that needs to be done. They are built by the parser and are simplified by the parser. The generic routines provide at least a minimal gateway to manipulate these trees very easily.

Secondly no namespaces will be allowed.

And yeah we are building an assembler anymore. We are going to use a very customized SPASM, although we still have to build the linker.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
HACC
« Reply #79 on: September 01, 2007, 12:05:00 pm »
i think jincs should stay in the channels and just change his nick to Jincs|away when he's idle, because most of the time I saw him leave he was still connected to the network, just not any channels

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #80 on: September 02, 2007, 02:06:00 pm »
@Ranman: I have been reading up on unions, since I never really use them since I thought they were useless like you. But I never realized that they could actually seriously help with memory addressing. E.g.

union {
    ui16 word[4];
    ui32 dword[2];
    i64 qword;
} 64_bit_location;

I don't know I am considering keeping unions in, unless there is a way that you can do that some other way?
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
HACC
« Reply #81 on: September 02, 2007, 03:27:00 pm »
QuoteBegin-Halifax+2 Sep, 2007, 20:06-->
QUOTE (Halifax @ 2 Sep, 2007, 20:06)
@Ranman: I have been reading up on unions, since I never really use them since I thought they were useless like you.

Well... I never said unions were "useless". I just don't think they are absolutely necessary.

QuoteBegin-Halifax+2 Sep, 2007, 20:06
-->
QUOTE (Halifax @ 2 Sep, 2007, 20:06)
But I never realized that they could actually seriously help with memory addressing. E.g.

union {
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #82 on: September 02, 2007, 09:28:00 pm »
But then you can't access the data as both bytes, words, and longwords etc. You can only access it is that certain type.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
HACC
« Reply #83 on: September 03, 2007, 01:17:00 am »
QuoteBegin-Halifax+3 Sep, 2007, 3:28-->
QUOTE (Halifax @ 3 Sep, 2007, 3:28)
But then you can't access the data as both bytes, words, and longwords etc. You can only access it is that certain type.  

 Sure you can...

Pointers and/or typecasting.
Shifting and/or masking.


But... How many actual programs are going to access data as bytes, words, and longwords at the same time? In my opinion, very few if any.

My point is... you are designing and implementing a compiler for a VERY limited system. You don't need all of the bells and whistles. Focus on the things that are absolutely necessary and make them small, fast, and efficient as possible. You can always add the icing later. ;)wink.gif
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
HACC
« Reply #84 on: September 03, 2007, 05:05:00 am »
@Ranman: providing you arent too much limited when coding either though ;)wink.gif

btw i was wondering if there was some progress in this or if it is still in planning stages?  

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #85 on: September 03, 2007, 12:28:00 pm »
@Ranman: I know what you mean, but the use of unions can lead to serious user optimizations. You can most definitely use unions that way for fixed point arithmetic! That is what I use them for all the time.

@DJ_Omnimaga: I would say some parts are more mature than other parts of Hacc. Our major concern is a fast compiler with greatly substantial optimizing. E.g. Shifts where a ^2 multiplication is used, constant elimination, and dead code elimination. Also register allocation has to be up to par. Right now I am currently defining and planning a special level to the compiler built specifically for optimizing.

Also just in case anyone is wondering, this isn't a once-and-done project. We will strive to keep this maintained, so don't worry if something is missing, or there are some bugs.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
HACC
« Reply #86 on: September 03, 2007, 01:09:00 pm »
QuoteBegin-Halifax+3 Sep, 2007, 18:28-->
QUOTE (Halifax @ 3 Sep, 2007, 18:28)
@Ranman: I know what you mean, but the use of unions can lead to serious user optimizations. You can most definitely use unions that way for fixed point arithmetic! That is what I use them for all the time.  

 That sounds pretty good.  :)smile.gif
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
HACC
« Reply #87 on: September 03, 2007, 01:46:00 pm »
nice deal I guess :)smile.gif, providing the output programs doesn't take twice as much memory than their BASIC or Z88dk counterpart it should all be good :)smile.gif

Offline JincS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +0/-0
    • View Profile
HACC
« Reply #88 on: September 03, 2007, 04:57:00 pm »
lol I forgot that you could have branch nodes too :Ptongue.gif I don't use trees all that often :(sad.gif
QUOTE
Also JincS you haven't seen the code since you only stop by the channel for 1 minute at the most and then leave ;)wink.gif. I am there almost everytime you do that, but I am working on HACC which takes up the full screen. If you message me it will make a sound and then I will know your there.


So that's where you're always at...

Ok, so no namespaces and no homebrew assembler...sounds good :)smile.gif I'll look into spasm and see what I can do about a linker then (assuming I can find the time->work's killing me, since I got bumped up to 8-hour weeks :cry: )...

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
HACC
« Reply #89 on: September 04, 2007, 04:52:00 am »
To work on the linker you are going to have to be brought up to speed on a number of different subjects dealing with Hacc. :(sad.gif

@DJ_Omnimaga: I don't even think it is possible to generate an executable as large as z88dk, especially if you keep your command-lines tight! Also you really can't have a BASIC counterpart to C.

Also I just want to say this also to people. Don't get false ideas that you can lay down horrible code and have Hacc output a perfect little piece of code. Steps to get you code looking nice:

1. Provide optimized C source code, and make sure no stupid things are done.
2. Let other people look over your code an optimized it.
3. Do research on which command lines are for you. There is an array of possible command line arguments already available for Hacc, and I can guarantee that more will come!

Let me just give an example of a command line argument that could or could not make a serious impact on the executable speed and size.

--forcejp

If this command line argument is present, then all jr's will be turned into jp's. So that means 1 byte per ever jr turned into a jp, but more speed also. My advice would be.

If you want size, then don't use --forcejp, but if you want speed, then use --forcejp. Now there are some things to take into consideration. For ever 'if' there is a jump, and for ever 'if-else' there is 2 jumps, and so on. So if your program is performing lots of decisions, then I recommend not using --forcejp.

Also if you have a very limited machine with less than 256 or 128 MB of ram or something you can also provide some command line arguments to reduce the amount of memory that is possible for Hacc to use. These are some advanced features though so I wouldn't advise these for any beginners though.

And as a final note. Don't expect perfect code from Hacc. If you are expecting perfect code, then Hacc, and probably any other compiler, isn't for you. Assembly language is the language for you.

EDIT:

I can't believe I forgot one of the main things I wanted to post about. The integration of the z80 assembly language right into the HACCLIB. I got this idea as I was reading an article on CELL programming because this is exactly what STL did to replace the horror of inline-assembly for there SPEs.

E.g.:

z80_rr(&plotsscreen, 1)

is an inline function that translate directly to one command: rr (hl) where hl points to plotsscreen.

So the whole z80 language will be represented in C and many low level assembly routines would be able to be represented in this way. Plus it integrates very well with your C program allowing you to easily program in pseudo assembly.

EDIT2:

Also I don't know if anyone cares, but support for local typedef definitions and local structure definitions will be completely dropped. The reason for this is because it is completely pointless and it just complicates parsing and handling of scopes. Just put the typedef or structure definition outside of any functions and then put a variable declaration in the same place you would put the local typedef or structure. It will generate the same code so don't worry about it.
There are 10 types of people in this world-- those that can read binary, and those that can't.