code logs -> 2008 -> Sat, 20 Dec 2008< code.20081219.log - code.20081221.log >
--- Log opened Sat Dec 20 00:00:38 2008
00:01
<@Vornicus>
It's a tractor.
00:01
<@Vornicus>
For refactoring.
00:03
<@Consul>
So if I have x^2+4x+4 and I need to factor it again, I break out a farm vehicle?
00:03
<@Vornicus>
yes.
00:03
<@Consul>
Indeed.
00:04
<@Vornicus>
http://en.wikipedia.org/wiki/Refactoring <--- more precisely, this is refactoring
00:04
<@gnolam>
<jerith> The Refactor Tractor is the metaphorical tool used to haul blocks of code around while refactoring on a grand scale.
00:04
<@gnolam>
<jerith> If you're hacking in fewer than four files simultaneously, you're not riding the refactor tractor.
00:04
<@gnolam>
<jerith> I think the term was invented by a coworker of mine.
00:04
<@gnolam>
<jerith> I grumbled about having to refactor a massive chunk of Java and he told me I was riding the refactor tractor.
00:04
<@Consul>
I know what it is, I was just wondering about the origin of the phrase.
00:06
<@Vornicus>
now we knwo
00:06
<@Consul>
Indeed.
00:08
<@Consul>
We have a neighbor we're sometimes at odds with, named Jeff. I made mention of something he said today, where I used the phrase "by 'Jeff logic'", and it hit me, that would be a great company name for a small company owned by a coder named Jeff.
00:08
<@Consul>
"If you need small, custom software solutions for your business, come to JeffLogic."
00:09
<@Consul>
I guess you had to be there.
00:10 * ToxicFrog weeps tears of black, acidic bile at the algorithm for eliminating non-immediate left-recursion
00:13
<@Vornicus>
whee
00:13
<@Vornicus>
poor tf
00:13 * McMartin has no pity whatsoever.
00:14
<@McMartin>
Because part of my dissertation involved adapting that algorithm to deal with infinite parameterized alphabets on both terminals and nonterminals.
00:14
<@McMartin>
Which causes the algorithm to become O(n^n) in the worst case.
00:14
<@McMartin>
And it's really quite terrifyingly easy to get into the O(n!) case.
00:19
<@ToxicFrog>
Happy fun times for all.
00:22
<@ToxicFrog>
...hmm.
00:22
<@ToxicFrog>
I just realized the problem with using lpeg.
00:22
<@ToxicFrog>
When the parse fails, you have no idea why.
00:23
<@McMartin>
That's why I switched to hand-coded parsers, personally.
00:23
<@McMartin>
This is arguably not the best approach~
00:25
<@ToxicFrog>
Yeah, I just fixed this with three lines of code, so~
00:26
<@ToxicFrog>
(specifically: the last alternative for a nonterminal is to call error() with the current parse location)
00:26
<@ToxicFrog>
(this may require additional tuning)
00:30
<@ToxicFrog>
...yeah, it does.
00:40
<@McMartin>
"Unexpected end of file in macro expansion"
00:40
<@McMartin>
:shakefist:
00:46 Derakon[AFK] is now known as Derakon
01:01 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
01:09 AnnoDomini [~farkoff@Nightstar-29718.neoplus.adsl.tpnet.pl] has quit [Quit: It is estimated that approximately one percent of the general population are psychopaths. They are overrepresented in prison systems, politics, law enforcement agencies, law firms, and in the media.]
01:24 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Ping Timeout]
01:50 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has joined #code
02:28
<@Consul>
Wow, no chromium in Fedora 10.
02:30 Consul_ [~consul@Nightstar-4909.dsl.sfldmi.ameritech.net] has joined #code
02:30
< Consul_>
This power button on the keyboard is really beginning to piss me off.
02:30 Consul [~consul@Nightstar-4909.dsl.sfldmi.ameritech.net] has quit [Connection reset by peer]
02:31 Consul_ is now known as Consul
02:32
< Tarinaky>
Pull it out?
02:33
< Consul>
Well, I can tell Windows to ignore those keys, but in Linux...
02:33
<@gnolam>
One of those annoying "multimedia keyboards", eh?
02:33
< Consul>
Not really, it just has an on-off, a sleep, and a wake button.
02:33
< Consul>
Right above the direction arrows.
02:34
< Consul>
And right below the insert/delete/etc.
02:34
< Consul>
It's easy to hit them by accident.
02:34
< Consul>
And as I said, in Windows, I can tell the OS to ignore them.
02:35
<@gnolam>
Edit .Xmodmap?
02:35
<@McMartin>
Actually, if you're using a GNOME-based system like Ubuntu or Fedora, there should be a Keyboard setting for turning that off
02:35
<@McMartin>
Or for saying "This is totally just a bog-standard 103-key keyboard and NOTHING ELSE ZOMG"
02:36
< Consul>
I thought I had, but apparently not.
02:36
<@McMartin>
I wonder if that keyboard is somehow directly tied to ACPI or something.
02:36
< Consul>
It's some cheap black plastic thing.
02:37
< Consul>
No brand name.
02:37
<@McMartin>
ACPI is the power-control interface, not a brand
02:37
< Consul>
There's a "Turbo" button with a fancy font below the enter key.
02:37 * gnolam 's keyboard is a dumpster find.
02:37 * Consul really wants another IBM hard-touch.
02:37
<@McMartin>
Model M hoorj
02:38
<@gnolam>
I'd get one of the repro Model Ms, but AFAIK they keep the microscopic enter key of the original.
02:38
<@McMartin>
Heh
02:41
< Consul>
I'm afraid to touch the turbo button now.
02:41
< Consul>
I don't think I ever have. It's out of the way enough.
02:42
< Consul>
Oh, apparently, this was designed to be a gamer's keyboard.
02:43
< Consul>
The turbo button is some kind of autofire.
02:43
< Consul>
Ooops, nevermind. I mis-skimmed the article.
02:44
< Consul>
Apparently, this keyboard dates from 486 days.
02:45
<@ToxicFrog>
gnolam: er, I have a model M sitting on my desk right now, and the enter key is normal-sized
02:48
<@ToxicFrog>
Wow, this AST has some ridiculous nesting.
02:48
<@ToxicFrog>
I wonder if I should work on that.
02:50
<@ToxicFrog>
(S (block (statement (varlist (var (atom (Name "lua")) (index (Name "suffix")))) (explist (exp (tableconstructor (...jesus christ this thing is nested six more levels deep, I'm not typing all that out...))))) ...more statements...))
02:52
<@McMartin>
That's fine.
02:53
<@McMartin>
More annotations for the win; it's only an army of robots that will be dealing with it anyway
02:53
<@ToxicFrog>
True.
02:53
<@Vornicus>
<3 armies of robots
02:54
<@ToxicFrog>
And the proof of concept for the mutable grammar works, too!
02:54
<@ToxicFrog>
I feed it some Obviously Fraudulent Code (lua code with a try-catch block in it) and it fails.
02:54
<@Vornicus>
TF, you are a frightening individual.
02:54
<@ToxicFrog>
Then I do:
02:55
<@ToxicFrog>
lua.stat = { 'try', lua.block, 'catch', lua.Name, 'with', lua.block, 'end' }
02:55
<@ToxicFrog>
lua:commit()
02:55
<@ToxicFrog>
And retry, and it gives me a pretty little AST.
02:55
<@ToxicFrog>
Vornicus: what? Scheme has been doing this forever.
02:56
<@ToxicFrog>
...it occurs to me that I can use this to get around the lexis restrictions without locale hacking, too.
02:57
<@ToxicFrog>
Mweeeehehehehehehehehe
02:57
<@Vornicus>
yes, but to do it on a language with a complex grammar.
02:57
<@ToxicFrog>
Eh, I already knew it could be done; metalua does it.
02:58
<@ToxicFrog>
It was just a matter of doing it in ~200 lines of Lua rather than in ~35k lines of bootstrap-requiring Metalua.
02:59
<@ToxicFrog>
...sorry, 11k, find got a bit overzealous on me.
02:59
<@ToxicFrog>
And the final size is going to be somewhat larger because I haven't written the code generator yet, only the parser.
02:59
<@ToxicFrog>
ON THE OTHER HAND
03:00
<@ToxicFrog>
Once it's done, this will work for any language that can be expressed as a PEG.
03:00
<@ToxicFrog>
Which gives us all the regular and context-free languages right off.
03:00 Tarinaky [~Tarinaky@Nightstar-16638.plus.com] has quit [Connection reset by peer]
03:00 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?]
03:01
<@ToxicFrog>
...although, since it's written in lua, its applicability to other languages will be somewhat more limited.
03:01
<@McMartin>
19:00 <@ToxicFrog> Once it's done, this will work for any language that can be expressed as a PEG.
03:01
<@McMartin>
19:00 <@ToxicFrog> Which gives us all the regular and context-free languages right off.
03:01
<@McMartin>
If it's LL(1), that's not *all* CFLs.
03:03
<@ToxicFrog>
PEGs are LL(*).
03:03
<@McMartin>
OK.
03:03 * McMartin does not recall offhand whether that's all CFLs. It's certainly not all CFGs, but that's not *quite* the same thing.
03:05
<@ToxicFrog>
I know PEGs can express some non-context-free languages, and I think they can express all context-free ones.
03:05
<@ToxicFrog>
Although I don't have a proof handy.
03:06
<@ToxicFrog>
They can definitely handle all regular languages.
03:06
<@McMartin>
I'd hope so, yeah.
03:08
<@ToxicFrog>
Anyways, time for celebratory food.
04:07 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
04:15 Reiver [~reaverta@Nightstar-7117.xdsl.xnet.co.nz] has joined #Code
04:15 mode/#code [+o Reiver] by ChanServ
04:24 Reiver [~reaverta@Nightstar-7117.xdsl.xnet.co.nz] has quit [Quit: Changing servers]
04:25 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
04:25 mode/#code [+o Reiver] by ChanServ
05:07 Derakon [~Derakon@Nightstar-4920.hsd1.ca.comcast.net] has quit [Operation timed out]
05:09
<@ToxicFrog>
It would help if I had something in the grammar to handle comments~
05:13
<@Vornicus>
yes.
05:53 * ToxicFrog rocks out to the Metroid Prime soundtrack, feeds the parser to itself
05:55
<@ToxicFrog>
Hmm.
05:55
<@ToxicFrog>
It dies on [[ io.write((" "):rep(depth)..(ast.tag or "WTF").."\n") ]]
05:59
<@Vornicus>
what's .. do?
05:59
<@ToxicFrog>
Concatenation.
05:59
<@Vornicus>
ah
06:01 * ToxicFrog determines that the Metroid Prime credits theme is in the key of D minor!
06:06
<@Serah>
-.^ ???
06:06
<@ToxicFrog>
Oh no I'm wrong, it's in A-
06:09
<@ToxicFrog>
And now that I've worked out how to play that, back to coding.
06:10
<@Serah>
You're fun, you know that?
06:10
<@Serah>
You play music too?
06:11
<@ToxicFrog>
Yes.
06:11
<@ToxicFrog>
Clarinet, oboe, and (very out of practice, because I hardly ever play these days except when inspiration strikes, like now) piano.
06:12 * jerith has a sudden urge to play his trombone, but it passes quickly.
06:13
<@jerith>
Mostly because it would require me to shave and I've just reached the point where my protobeard no longer itches even when it's hot.
06:14
<@ToxicFrog>
Heh.
06:14
<@ToxicFrog>
I prefer the woodwinds to the piano, but I'm not breaking out the clarinet at 0100 in a shared house.
06:15 * jerith wouldn't break out the trombone at any time of day in a flat with moderately thin walls.
06:15
<@Serah>
Clarinet? Oboe? I wouldn't have guessed.
06:16
<@ToxicFrog>
What would you have guessed?
06:19 * jerith has always had a soft spot for the bassoon.
06:19
<@ToxicFrog>
Never tried that. Similar architecture to the oboe, though, I could probably manage.
06:19
<@jerith>
It apparently needs long fingers.
06:20
<@jerith>
A good friend of mine plays it.
06:20
<@jerith>
I've always found the oboe a bit whiney, unless played by someone really good.
06:21
<@Serah>
Piano.
06:21
<@jerith>
I never got the hand of the piano.
06:22
<@jerith>
Probably because I have very little theory.
06:22
<@jerith>
*hang
06:23 * jerith feels like going somewhere nice(ish) for breakfast.
06:24 * Serah shuts down.
06:24 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has quit [Quit: Be right back, got some smiting and righteous justice to attend to.]
06:24
<@jerith>
A place with decent coffee.
06:30
<@ToxicFrog>
Aha
06:36
<@Vornicus>
Aha?
06:36
<@ToxicFrog>
Found the problem
06:36
<@ToxicFrog>
Or at least, found out where the operation is occuring
06:36
<@Vornicus>
?
06:36
<@ToxicFrog>
The (" "):rep(depth) is confusing it.
06:36
<@ToxicFrog>
Ot
06:36
<@ToxicFrog>
It's doing fine until it finishes parsing the (" ")
06:37
<@ToxicFrog>
Then it decices that it was wrong about the whole thing being a binop and backtracks, and things go downhill from there.
06:37
<@Vornicus>
*snrk*
06:40
<@ToxicFrog>
Now to find out why.
06:45 * ToxicFrog changes the order of alternates for val, fixes it
06:51 Reiver is now known as ReivOut
06:58
<@ToxicFrog>
Fails on [[ if i <= #src then ]]
06:58
<@ToxicFrog>
Guess what? Same bug.
06:58
<@ToxicFrog>
Or rather, same underlying mistake: getting the priorities wrong in the grammar.
06:59
<@ToxicFrog>
Of note is that all the problems I've been running into since dinner are problems with my Lua grammar, not with the core library.
06:59
<@ToxicFrog>
Which is promising.
07:09
<@ToxicFrog>
...trace mode on this line of source:
07:09
<@ToxicFrog>
lpeg.Cmt(lpeg.P(start) * (lpeg.C(v) + lpeg.Cmt("", finish)), check)
07:10
<@ToxicFrog>
...generates 147 thousand lines of output.
07:32 * ToxicFrog blinks
07:32
<@ToxicFrog>
I did a minor optimization on the grammar
07:32
<@ToxicFrog>
And this
07:32
<@ToxicFrog>
(1) cut the amount of output in trace mode by a factor of at least six
07:32
<@ToxicFrog>
(2) fixed the bug I was seeing
07:32
<@ToxicFrog>
And now it generates a complete AST for itself.
07:32
<@McMartin>
Sweet.
07:34
<@ToxicFrog>
(specifically, the optimization was replacing: exp -> prefix exp | val infix exp | val; with exp -> prefix exp | val [infix exp];
07:35
<@ToxicFrog>
Hmm. I need a name for this project.
07:35
<@Vornicus>
Cheese Extraction Factory
07:36
<@ToxicFrog>
....tempting
07:44
<@ToxicFrog>
local parser = require "Cheese Extraction Factory"
07:45
<@McMartin>
If error reporting still sucks, you can make all the errors "*** OUT OF CHEESE ERROR ***"
07:46
<@ToxicFrog>
Error reporting still sucks, but I know how to fix it.
07:46
<@ToxicFrog>
Or at least approximate fixing it.
07:46
<@McMartin>
*** RE-IMPORT UNIVERSE AND RESTART ***
07:47
<@ToxicFrog>
Part of the problem is that when it hits invalid code, it starts backtracking further and further; in trace mode you can see it thinking "shit, that didn't work either. Maybe if I parse 'if' as an identifier and work from there..." and things really do not go at all well from that point onwards.
07:48
<@ToxicFrog>
...I just realized how to fix that behaviour
07:48
<@Vornicus>
...say "no, if really isn't an identifier"?
07:49
<@ToxicFrog>
Change the definition of Name from [[ (Alpha + _) * (Alphanum + _)^0 ]] by suffixing [[ - reservedword ]]
07:49
<@ToxicFrog>
And define reservedword appropriately.
07:55
<@ToxicFrog>
Done!
07:55
<@ToxicFrog>
0.07s to parse 2.6k of source correctly.
07:55
<@Vornicus>
wootutron
07:55
<@ToxicFrog>
Including IO.
07:59
<@ToxicFrog>
That's 12 hours of straight coding.
08:00 * ToxicFrog goes to play some CoD, now that everything is working.
08:00
<@Vornicus>
Yay
08:28 You're now known as TheWatcher
08:28 * ToxicFrog participates in the battle of Stalingrad
09:07
<@jerith>
Yay parser!
09:28 AnnoDomini [~farkoff@Nightstar-29625.neoplus.adsl.tpnet.pl] has joined #Code
09:28 mode/#code [+o AnnoDomini] by ChanServ
09:31 Vornicus is now known as Vornicus-Latens
10:33 grossroot[idle] is now known as grossroot
10:45 You're now known as TheWatcher[afk]
10:55 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
10:55 mode/#code [+o gnolam] by ChanServ
11:24 * jerith wants a fold comprehension.
11:24
<@jerith>
Like a list comprehension, except it reduces instead of building a list.
13:14 You're now known as TheWatcher
14:58 crem_ [~moo@Nightstar-28703.adsl.mgts.by] has joined #code
14:58 crem [~moo@Nightstar-28703.adsl.mgts.by] has quit [Connection reset by peer]
17:13 You're now known as TheWatcher[afk]
17:18 AnnoDomini [~farkoff@Nightstar-29625.neoplus.adsl.tpnet.pl] has quit [Quit: "I cast Detect Law!" "There's an attorney around the corner."]
18:36 You're now known as TheWatcher
19:32 grossroot is now known as grossroot[idle]
20:14 Brother_Willibald [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
20:14 gnolam is now known as NSGuest-617
20:14 Brother_Willibald is now known as gnolam
20:14 NSGuest-617 [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Ping Timeout]
21:12 ReivOut [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
21:23 Consul [~consul@Nightstar-4909.dsl.sfldmi.ameritech.net] has quit [Quit: Leaving]
21:39 Consul [~consul@Nightstar-4909.dsl.sfldmi.ameritech.net] has joined #code
21:40 mode/#code [+o Consul] by ChanServ
21:41 ReivOut [~reaverta@Admin.Nightstar.Net] has joined #Code
21:54 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has joined #Code
21:54 mode/#code [+o Serah] by ChanServ
21:57 Brother_Willibald [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
21:57 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Ping Timeout]
21:57 Brother_Willibald is now known as gnolam
22:08 Vornicus-Latens is now known as Vornicus
22:23 grossroot[idle] [~grossroot@Nightstar-2147.hackthisbox.org] has quit [Quit: Lost terminal]
22:56 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Ping Timeout]
22:58 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
22:58 mode/#code [+o ToxicFrog] by ChanServ
--- Log closed Sun Dec 21 00:00:50 2008
code logs -> 2008 -> Sat, 20 Dec 2008< code.20081219.log - code.20081221.log >