Author Topic: Axe Parser  (Read 495739 times)

0 Members and 2 Guests are viewing this topic.

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 #1875 on: July 08, 2011, 04:08:16 pm »
Umm, does this have something to do with using subroutines as functions?
(Where a function is a thingy that returns a value based off of input)
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 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 #1876 on: July 08, 2011, 07:28:57 pm »
Map(λ(r12),L1,100)
I have couple remarks on that :)
First of all, since we will presumably be able to make routines such as Map( ourselves, could you show us the syntax for calling a subroutine by address? (Something like sub(r1, ...)r, perhaps? (Where r1 is any expression))
Secondly, will inlining be supported? (In general, not just for Map() That is, if an anonymous subroutine (or lambda, whatever you want to call them) is passed to a routine and that routine has a call for it exactly once, will the compiler replace the call with the routine itself? Otherwise, your example, among other useful invocations, will be much slower than it should be. ;)
« Last Edit: July 08, 2011, 07:29:57 pm by calcdude84se »
"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 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 #1877 on: July 08, 2011, 07:33:22 pm »
Well, as someone who uses them all the time in programming, I can say they are very useful in many situations.  They can help reduce the number of methods needed to evaluate a certain value.  DeepThought gives a decent example with different features per level, such as if you had two different levels of gravity:

Code: [Select]
@gravity = lambda {|cur_level|(cur_level%5==0)?(1):(2)} / air_density
So that every five levels the lambda would return 2 instead of 1.  In that example you could take out the lambda and still be fine, but there are even bigger needs for it when you need to directly pass values as parameters into complex equations with highly varying outputs or when you go to attach them to variables directly so that a variable's state is defined by input parameters.  Which brings me to ask, quigibo: are you thinking of adding full support for lambdas/procs with variable attachments and inlining functions, or just inlining?

EDIT: hmm, so the case here isn't just that many don't know how to use them, but that they also don't know what they are :P understandable.  In a nutshell:

Lambdas are functions that stand in for single values (though in some cases they can return multiple values, but don't worry about that most languages don't even support it).  They can take passed arguments and can contain code that'll evaluate expressions and return values accordingly.  Very, very useful.  For a decent background, here's the wikipedia link Qwerty pointed me to a long time ago that I found very helpful: http://en.wikipedia.org/wiki/Lambda_calculus

Ok, so a lambda is basically a subroutine taking a place of a number.  Sounds cool ;)
So I'm guessing something like...
sub(GC)→P
[...]
Lbl GC
GetCalc(Str0L)
Return

...would work?
« Last Edit: July 08, 2011, 08:46:13 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #1878 on: July 08, 2011, 08:18:34 pm »
Map(λ(r12),L1,100)
I have couple remarks on that :)
First of all, since we will presumably be able to make routines such as Map( ourselves, could you show us the syntax for calling a subroutine by address? (Something like sub(r1, ...)r, perhaps? (Where r1 is any expression))
Secondly, will inlining be supported? (In general, not just for Map() That is, if an anonymous subroutine (or lambda, whatever you want to call them) is passed to a routine and that routine has a call for it exactly once, will the compiler replace the call with the routine itself? Otherwise, your example, among other useful invocations, will be much slower than it should be. ;)

To answer your first question, you'll probably want to call most functions with a label name, like Map(ARGS). However, you will now be able to call arbitrary addresses as well with (ADDRESS)(ARGS); (ADDRESS) is like a stand-in for the name of the function.

To answer your second question, the point of passing anonymous subroutines to functions as pointers is so you can pass any routine's pointer. The compiler will have no idea if a certain routine of yours is only ever going to be called with a pointer to one external function. If you're only going to pass one external function into your function, then you should just incorporate the first inside of the second.
« Last Edit: July 08, 2011, 08:20:59 pm by Runer112 »

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 #1879 on: July 09, 2011, 07:42:06 pm »
Ah, thanks for the syntax. As for the second, understood. (But I can't do that for built-ins :P)
"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 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 #1880 on: July 13, 2011, 07:45:09 am »
Well its finally here!  Believe it or not, there were still a whole lot of features I wanted to add before releasing it, but the contest deadline is coming up and I've already been delaying too much so I'm going to release it now for better or worse.  Some of the changes are really dramatic, so it will definitely take some time to get used to the paradigm shifts that come with it.

So I was going to write a really long post saying how far the project has come and how much the community has helped me code, test, and popularize Axe Parser.  But then I realized that it would sound like a culmination, and I don't want it to seem at all like I'm done coding or that the parser is finalized.  Also, its 4:30 AM for me right now and I've been staying up this late this whole week trying to get this thing out the door, so I'd rather get some sleep instead.  You guys already know how awesome you are, you don't need me to tell you that  :hyper:

Hopefully there won't be any major bugs since I've been testing it with a few other people and have fixed all the bugs uncovered so far.  So have fun and hopefully everyone in the contest can adapt their code for 1.0.0, there weren't too many incompatibilities for this size of a release and all of them are extremely easy to fix.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Axe Parser
« Reply #1881 on: July 13, 2011, 07:57:27 am »
Kudos to you. You said you were going to attempt a release before the contest deadline and you made it. 1.0 is here, and my hat is off to you sir. It must feel great to have 1.0 released, it's been an amazing journey watching this develop. I look forward to seeing it's continued development and improvement as well. Excellent job!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Parser
« Reply #1882 on: July 13, 2011, 08:03:29 am »
You guys already know how awesome you are, you don't need me to tell you that  :hyper:

I know I'm awesome, but making me lose the game was unnecessary.

But in all seriousness, this seems like an awesome update, Quigibo, you're the awesome one :hyper:

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Axe Parser
« Reply #1883 on: July 13, 2011, 08:04:56 am »
Congratulations on this wonderful release!

Axe has certainly made a massive impact on the entire TI community.  You most certainly deserve a huge rou dof applause for your excellent work! :)


Ashbad

  • Guest
Re: Axe Parser
« Reply #1884 on: July 13, 2011, 10:29:47 am »
Unlike what a few Axe Gurus say about this release, I personally find it a step in a wonderful direction.  Beautiful job with the new supported functional aspects, Axe is no longer the FORTRAN II of calculators (by this I mean its main purpose was just to be a compiled language that focused on heavy optimization and few modern aspects).  There are many thing I still would like to see added, but this version is wonderful, great job overall.  I really do like how this version is more of added language features and not trivial optimizations or commands.

TL;DR: :)
« Last Edit: July 13, 2011, 10:30:23 am by Ashbad »

Offline GreenFreak

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +16/-1
    • View Profile
Re: Axe Parser
« Reply #1885 on: July 13, 2011, 10:44:35 am »
HELP!
My calc crashed! (because of Axe 1.0.0!)
I'd tried to do little changes:

0->{L1}^r
Fill(L1,58)

It took (my wohle game (compiled) ) 1914 bytes

Then I tried to use the new Fill( comand and compiled the game:

Fill(L1,58,0)

It was ~40 bytes smaller. (Not only because of this change, but also through the new optimizations of Axe.)
Wow, I thought and redid it, to see the old size of the compiled game..

BUT THEN: (after compiling) : "Backing up.."
BAM! Calc turned off. When I tried to turn it back on, It showed the "Backing up.." screen and turn off (after a second) again.

So I took out a battery, but that didn't helped, so I started my with [clear] + [on] : RAM cleared, (and everything else (but not the apps), too.)

 :'(  Is that a major bug? Or a mistake on my part??

I was so happy because of the release of Axe v. 1.0.0  :'(


EDIT: Fortunately I've everything back-up'd on my PC a few days before! ;) I'm sooo happy about that! :D
BUT: Please find the bug, Quigibo!!

EDIT2: I'm not able to redo this...
« Last Edit: July 13, 2011, 11:04:02 am by GreenFreak »

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Axe Parser
« Reply #1886 on: July 13, 2011, 10:52:38 am »
ask runner.
ruunner knows everything.
*insert supercool signature*

Offline GreenFreak

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +16/-1
    • View Profile
Re: Axe Parser
« Reply #1887 on: July 13, 2011, 11:00:39 am »
;D I know that ;D
So: Quigibo, or Runer112 :P, tell me, what could went wrong, please!


PS: Oh, ein Deutscher ;D
« Last Edit: July 13, 2011, 11:01:52 am by GreenFreak »

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Axe Parser
« Reply #1888 on: July 13, 2011, 11:04:13 am »
only Runner is on.
send him a PM, if you want to.

But post the answer here.
( want to learn something, too!)   ;)




DU BIST AUCH DEUTSCH / DU VERSTEHST DEUTSCH?  :o
*insert supercool signature*

Offline GreenFreak

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +16/-1
    • View Profile
Re: Axe Parser
« Reply #1889 on: July 13, 2011, 11:07:12 am »
Jaaa, kannste mal sehen... (steht über dem Avatar)

bisschen off-topic ;D

Ich denke, dass Runer das von alleine liest...

EDIT: How to join #omnimaga irc?
« Last Edit: July 13, 2011, 11:12:06 am by GreenFreak »