• Axe Parser 5 1
Currently:  

Author Topic: Axe Parser  (Read 492608 times)

0 Members and 7 Guests are viewing this topic.

Offline yoman82

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +1/-1
    • View Profile
Re: Axe Parser
« Reply #1815 on: June 02, 2011, 12:57:05 pm »
I would love that. Poll-worthy?

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1816 on: June 09, 2011, 06:28:40 pm »
I have a little conundrum.  As soon as I allow forward referencing of constants, there is immediately going to be a problem with auto-optimizations.  If the constant value is unknown when it gets to a routine that can auto-optimize (lets say for this example multiplication), it won't know which optimization to do because it doesn't know if its *2, *3, *4, etc.  All it can assume is that its some constant.  I can't just skip over this and come back later when the value is known because each auto-opt is a different size and parsing cannot continue unless the future addresses are correct.  So in this case, it would have to assume the worst case and always use the multiplication subroutine, regardless of the value.

This is avoided simply by declaring a constant BEFORE you use it instead of after, but its noteworthy.  I've already been doing this with pointers but you don't notice because pointers have values like "$9EF0" for instance so those never auto-optimize anyway and you never use them in math other than addition and subtraction.  I'm stumped to think of a way around this though, anyone have any ideas?  I suppose its not too big of a deal either way.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1817 on: June 09, 2011, 07:01:16 pm »
You could add a first pass for the sole purpose of finding user-defined constants. Not a terribly elegant solution, but it would work. 

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Axe Parser
« Reply #1818 on: June 09, 2011, 07:11:29 pm »
You could add a first pass for the sole purpose of finding user-defined constants. Not a terribly elegant solution, but it would work.
That'd be the easiest way around it, but at the cost of compiling speed.

However, usually its bad practice using a constant before you define it anyways, so it shouldn't be much of a problem.

So, basically, its either a stricter (but still extremely intuitive) syntax (at a penalty of everything before the define not getting optimized), or a slower (less elegant) compile-time.

I vote for stricter syntax, even though I wouldn't care if it took longer to compile.
« Last Edit: June 09, 2011, 07:12:25 pm by lookitsan00b »
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1819 on: June 09, 2011, 07:17:11 pm »
Yeah, I was thinking about that, but it could take an infinite amount of passes to resolve the constants, like:

oB->oC
oA->oB
5->oA


The first pass can assign A, and B the second pass, but C would not be identified then.  I'm going to have to re-think a lot of this actually and figure out some rules that will make this easy to implement... probably something like the above example would be illegal.  Perhaps I will make a rule like you cannot store to a static unless everything on the left hand side is declared already.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Parser
« Reply #1820 on: June 09, 2011, 07:45:48 pm »
Perhaps I will make a rule like you cannot store to a static unless everything on the left hand side is declared already.
I think that's the way to do it. :)

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1821 on: June 09, 2011, 07:55:32 pm »
That includes sprites too though.  You can't do:

Pic1+8->Pic2
Pt-On(0,0,Pic2)
[]->Pic1


However, you could do:

Pt-On(0,0,Pic2)
[]->Pic1
Pic1+8->Pic2


And you can always declare the sprite first like Axe has been doing so far:

[]->Pic1
Pic1+8->Pic2
Pt-On(0,0,Pic2)
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #1822 on: June 10, 2011, 12:07:41 am »
I vote for declaring what it is before using it.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: Axe Parser
« Reply #1823 on: June 10, 2011, 10:49:21 am »
I think that you should just define it before you use it. That's the best solution for calc. There isn't a reason why you would extract the defines into a seperate program, except that it wouldn't get backed up.

The reason why they would put the defines at the bottom is because they don't want to scroll through them. So, I think that we need to do one of these two things:
- Allow jumping to a label/define when editing, so you don't have to scroll through the data or preliminary code.
- Create an alternate version of the editor with code folding. In code folding, you look for all of the definite code blocks (If-End, While-End, Lbl-Return, etc) and let people use a key to hide them, replacing them with a little plus thing. They can then press a key again to expand the block again.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1824 on: June 14, 2011, 11:51:29 pm »
Just wanted to give everyone a quick update on progress.

This is day 6 of the rewrite.  I can now parse simple programs and have data, labels, variables, and gotos working correctly.  Though I still need to rewrite subs, interrupts, internal subroutines, and axioms.  So currently, I cannot compile any large programs, but I'm almost at the point where I can.  There is at least one extra MAJOR convenience feature that was requested a long time ago that will finally make it to the update, but I won't spoil what it is yet. ;) I still have no idea when it'll be finished because of all the inevitable unexpected issues to come, but hopefully before the end of the month.
« Last Edit: June 14, 2011, 11:51:58 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Parser
« Reply #1825 on: June 14, 2011, 11:57:36 pm »
Whoa, this is a huge rewrite... You might as well call it 2.0 O.O




Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Parser
« Reply #1826 on: June 15, 2011, 01:15:22 am »
Whoo, awesomesauce Quigibo!
Does this mean we can use this awesomeness in the contest?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Axe Parser
« Reply #1827 on: June 15, 2011, 11:18:19 am »
Just wanted to give everyone a quick update on progress.

This is day 6 of the rewrite.  I can now parse simple programs and have data, labels, variables, and gotos working correctly.  Though I still need to rewrite subs, interrupts, internal subroutines, and axioms.  So currently, I cannot compile any large programs, but I'm almost at the point where I can.  There is at least one extra MAJOR convenience feature that was requested a long time ago that will finally make it to the update, but I won't spoil what it is yet. ;) I still have no idea when it'll be finished because of all the inevitable unexpected issues to come, but hopefully before the end of the month.

That sounds great! Some of you guys really are coding BEASTS =)

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Parser
« Reply #1828 on: June 15, 2011, 11:20:10 am »
Just wanted to give everyone a quick update on progress.

This is day 6 of the rewrite.  I can now parse simple programs and have data, labels, variables, and gotos working correctly.  Though I still need to rewrite subs, interrupts, internal subroutines, and axioms.  So currently, I cannot compile any large programs, but I'm almost at the point where I can.  There is at least one extra MAJOR convenience feature that was requested a long time ago that will finally make it to the update, but I won't spoil what it is yet. ;) I still have no idea when it'll be finished because of all the inevitable unexpected issues to come, but hopefully before the end of the month.
Wow... You're doing a FULL rewrite?
Also the request... Im curious. you should say it I cant wait waaahh D:
« Last Edit: June 15, 2011, 11:22:25 am by aeTIos »
I'm not a nerd but I pretend:

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Parser
« Reply #1829 on: June 16, 2011, 06:29:46 am »
Yay!  I can finally parse STARSHIP and have it work.  I still need to fix a bunch of miscellaneous things though.

Since I'm rewriting the engine anyway, I figured I might also want to add another feature to the auto-optimizer, something called "Peephole Optimization".  The way it works is basically every time the parser writes an inline instruction, it will scan upwards several bytes and see if the code matches a list of patterns.  If it does, it will replace the code with the more optimized version and then continue writing.  If this works, then its possible Axe programs can get EXTREME :o optimizations approaching that of a moderate z80 coder. It could result in up to a 5-10% decrease in code size plus a small speed boost!

I am going to try to make these open source like I have been doing with the commands so that others can help me with them, hopefully I can find a good system for it.  This is all speculation though, I'm not sure if I'll have time or add it at all if it gets too complex, but I'm hoping it can work.  This could also render a lot of those weird Axe tricks obsolete since they would happen automatically, like 0->A:0->B could automatically optimize to 0->A->B.
___Axe_Parser___
Today the calculator, tomorrow the world!