Author Topic: Axe Parser  (Read 555158 times)

0 Members and 3 Guests are viewing this topic.

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Parser
« Reply #1920 on: July 23, 2011, 08:09:20 am »
I am back to 0.5.3 (which works fine :) ) and I noticed that compiling is much, much faster. Were that many new features added to Axe 1?

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Axe Parser
« Reply #1921 on: July 23, 2011, 08:16:26 am »
Much was re-written or changed entirely, so yea. It was quite a big update.

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 #1922 on: July 23, 2011, 11:17:44 am »
I am back to 0.5.3 (which works fine :) ) and I noticed that compiling is much, much faster. Were that many new features added to Axe 1?
Yes, and tons of new features were added, allowing variable names to be longer, forward referencing, a much, much higher variable limit, and other changes.  This translates to slower parsing, but it's more flexible this way. :D

Ashbad

  • Guest
Re: Axe Parser
« Reply #1923 on: July 23, 2011, 01:59:31 pm »
I am back to 0.5.3 (which works fine :) ) and I noticed that compiling is much, much faster. Were that many new features added to Axe 1?
Yes, and tons of new features were added, allowing variable names to be longer, forward referencing, a much, much higher variable limit, and other changes.  This translates to slower parsing, but it's more flexible this way. :D

You forgot the addition of primitive functional aspects ;)

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 #1924 on: July 24, 2011, 02:36:58 am »
Actually, the slowdown is entirely due to yet another major feature, the one that required the most core rewriting, which is the peephole optimizations.  The parser now writes commands instruction by instruction instead of byte by byte so it can optimize out any sub-optimal patterns it sees along the way, cutting code size an extra 1-2% and setting it up for future reductions of probably 5% or more.  It should eventually allow you to write code in a more natural way and then automatically convert it to code that is more "Runer Style" as I like to call it ;)
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Parser
« Reply #1925 on: July 24, 2011, 04:35:21 am »
It should eventually allow you to write code in a more natural way and then automatically convert it to code that is more "Runer Style" as I like to call it ;)
Runer Style? I wonder why you call it that?  <_<
* mrmprog can't wait until he can code in a way that humans can read, and have the compiled program hyper-optimized!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Parser
« Reply #1926 on: July 24, 2011, 05:28:01 am »
I am back to 0.5.3 (which works fine :) ) and I noticed that compiling is much, much faster. Were that many new features added to Axe 1?
Yes, and tons of new features were added, allowing variable names to be longer, forward referencing, a much, much higher variable limit, and other changes.  This translates to slower parsing, but it's more flexible this way. :D

I did not know we could have longer variable names, that's sweet!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1927 on: July 24, 2011, 09:11:00 am »
It should eventually allow you to write code in a more natural way and then automatically convert it to code that is more "Runer Style" as I like to call it ;)

And I'll still find ways to optimize it. ;D But cool nonetheless. Although a lot of the optimizations I perform now are somewhat natural to me, it would be nice if Axe could perform a few of them itself. Even my own optimized code confuses me sometimes.


Will this system be able to look over code that wouldn't affect the value in the registers? By that, I mean will it be able to optimize something like:

Code: [Select]
0→A
1→B

Into:

Code: [Select]
ld hl,0
ld (A),hl
ld l,1 ;or even inc l if you can pull it off
ld (B),hl
« Last Edit: July 24, 2011, 09:35:38 am by Runer112 »

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Parser
« Reply #1928 on: July 24, 2011, 09:20:47 am »
* mrmprog senses a challenge...
Who can make the most optimized code? Runer with the source, or Quigibo with the parser?  8)


/cue dramatic music

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Parser
« Reply #1929 on: July 24, 2011, 11:08:02 pm »
..or runer and others helping quigibo with the parser :P
Vy'o'us pleorsdti thl'e gjaemue

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Parser
« Reply #1930 on: July 25, 2011, 07:45:43 am »
Quigibo just released Axe 0.0.2, it fixes all the bugs in the 1.0.1 :)

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Parser
« Reply #1931 on: July 25, 2011, 07:56:47 am »
Quigibo just released Axe 0.0.2 1.0.2, it fixes all the bugs in the 1.0.1 :)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

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 #1932 on: July 25, 2011, 07:56:59 am »
Even though this isn't a new feature, its new in the fact that it's now optimized enough to be useful.  Calc84maniac gave me the idea over chat:

You can use the ternary operator to short circuit a list of conditions for any statement.  For example, instead of doing:
Code: [Select]
:If A
:If B
:If C
:<code>
:End:End:End
You can now inline the comparisons using the ternary:
Code: [Select]
:If A?B?C,,
:<code>
:End

These both compile to essentially the same code.  To break it down since its not immediately obvious why these 2 are the same, consider the grouping Axe is doing internally:
Code: [Select]
If (A?(B?(C),<b is false>),<a is false>)Basically it checks A, if A is false, there is no code, so it returns the last statement evaluated which is 0 since it was false.  If true, it checks B and again returns false if B is false.  Finally, if B is true, it just returns C's condition which will determine if the entire statement is true or false :)

Its a really nice shorthand! (even though the trailing commas might look ugly)  You can also use it for while and repeat statements which I don't think was possible before.
« Last Edit: July 25, 2011, 07:58:06 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1933 on: July 25, 2011, 12:04:49 pm »
Yay, short-circuit conditions! :) Is there a way to do something similar with "or" along with "and"?
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1934 on: July 25, 2011, 12:32:11 pm »
Yep, instead of If A+B+C, you can do If A?,B?,C
« Last Edit: July 25, 2011, 12:33:40 pm by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman