←2004-06-10 2004-06-11 2004-06-12→ ↑2004 ↑all
00:22:23 <lament> oh god.
00:22:58 <lament> my Normalizer decreases the size of wib from 6287 to 6097 instructions.
00:23:27 <lament> that's 3%!
00:23:39 <lament> i wonder if it still works afterwards... :)
00:27:16 <lament> Clearly people don't bother about optimizing their Brainfuck code at all!
00:28:28 <lament> oh, and there has to be a way to normalize things containing ., and not just +-<>
00:28:53 <lament> or maybe not...
00:29:53 <lament> >>>>>.<<<<<+>+>+>+>+> clearly should be +>+>+>+>+>.
00:30:13 <lament> but my normalizer would not touch it.
00:30:54 -!- andreou has joined.
00:33:50 <fizzie> well, isn't it enough to gather all the +s and -s affecting the cell you're .ing or ,ing from/to and make sure those happen in order. not sure how your "normal form" is specified though.
00:34:13 <fizzie> uh-oh, it's already past 02:30 here, I think I'll sleep some.
01:38:03 <andreou> one hour later, same situation
01:38:04 -!- andreou has quit ("If it doesn't have 36 bits, you're not playing with a full DEC.").
02:42:51 -!- andreou has joined.
03:54:53 -!- calamari_ has joined.
03:54:56 <calamari_> hi
04:14:56 <Toreun> g'evening
04:16:54 <lament> hi
04:16:56 <calamari_> I was thinking about the c compiler.. a valid way to do it is c -> asm, then asm -> binary (bf). That would actually be pretty neat, because then the c compiler doesn't have to worry about many details
04:17:25 <Toreun> yeah
04:17:29 <lament> perhaps even asm->basic? :)
04:17:32 <lament> basic->brainfuck
04:17:39 <Toreun> that's disgustingly complex
04:17:40 <Toreun> I like it
04:18:01 <calamari_> lol
04:19:02 <calamari_> bfbasic could be rewritten to support the asm, removing a lot of the limitations
04:19:39 <lament> that will certainly be quite neat.
04:21:54 <calamari_> I was thinking about 32-bit cells.. it would take a lot of work and bloat the code if 32-bit cells had to be emulated with four 8-bit cells.
04:23:15 <calamari_> so the bf interpreter/compiler will probably need to be 32-bit
04:24:46 <lament> that's fine.
04:26:36 <calamari_> afaict signed and unsigned math is pretty much the same (except when reporting overflow situations), but comparisons don't work the same way
04:30:05 <calamari_> any suggestions on how to do a signed compare of > or <?
04:34:48 -!- andreou has quit ("If it doesn't have 36 bits, you're not playing with a full DEC.").
05:01:51 * lament is reading the paper on the Analytical Engine
05:01:55 <lament> absolutely amazing stuff.
05:03:29 <calamari_> aha, I think I have found a way. if after a decrement a number equals 127 then an answer reversal byte is toggled. it has to be toggled because if both numbers were negative then the compare works like if it were positive
05:04:18 <calamari_> (i.e. -2>-3 is the same as 6>5 in a 3-bit mode)
06:18:36 -!- calamari_ has quit ("Leaving").
07:59:59 -!- clog has quit (ended).
08:00:00 -!- clog has joined.
09:35:02 -!- andreou has joined.
09:40:50 -!- captor has joined.
10:00:42 -!- andreou has quit (Read error: 113 (No route to host)).
10:09:15 -!- captor has quit (Read error: 60 (Operation timed out)).
14:18:01 -!- grumpy_old_one has quit (calvino.freenode.net irc.freenode.net).
14:18:01 -!- lament has quit (calvino.freenode.net irc.freenode.net).
14:18:03 -!- ChanServ has quit (calvino.freenode.net irc.freenode.net).
14:18:06 -!- kosmikus has quit (calvino.freenode.net irc.freenode.net).
14:18:06 -!- mtve has quit (calvino.freenode.net irc.freenode.net).
14:18:07 -!- cmeme has quit (calvino.freenode.net irc.freenode.net).
14:18:08 -!- mooz- has quit (calvino.freenode.net irc.freenode.net).
14:18:08 -!- fizzie has quit (calvino.freenode.net irc.freenode.net).
14:18:09 -!- deltab has quit (calvino.freenode.net irc.freenode.net).
14:18:09 -!- Taaus has quit (calvino.freenode.net irc.freenode.net).
14:18:09 -!- edwinb has quit (calvino.freenode.net irc.freenode.net).
14:18:47 -!- grumpy_old_one has joined.
14:18:47 -!- lament has joined.
14:18:55 -!- edwinb has joined.
14:19:14 -!- ChanServ has joined.
14:19:14 -!- kosmikus has joined.
14:19:14 -!- mtve has joined.
14:19:14 -!- irc.freenode.net has set channel mode: +o ChanServ.
14:19:44 -!- cmeme has joined.
14:19:44 -!- mooz- has joined.
14:19:44 -!- Taaus has joined.
14:19:44 -!- deltab has joined.
14:19:44 -!- fizzie has joined.
16:50:06 -!- calamari_ has joined.
16:50:17 <calamari_> hi
17:48:05 <lament> hi
18:02:10 <lament> optimizing BF .,<>+- sequences is tough.
18:02:20 <lament> i'm trying to figure out a nice way to do it.
18:03:04 <lament> for example, >+<.>,<- should be optimized to .->,
18:04:27 <lament> ideally, the optimizer should be written in brainfuck.
18:07:49 <calamari_> why?
18:08:08 <calamari_> just convert it to bf when you're done :)
18:08:23 <lament> what, you've already written your c->BF compiler? :)
18:08:45 <calamari_> nope.. working on the assembler. it's going slow, though, because I'
18:08:57 <calamari_> m only using if's, labels, and gotos
18:09:11 <calamari_> (for easy translation of the assembler to bfasm :)
18:09:14 <lament> how would you do IO?
18:09:22 <lament> assembly programs call the kernel for that.
18:09:26 <lament> You'll be emulating the kernel?
18:09:49 <calamari_> ?? there are two asm instructions in_ and out, for that
18:10:23 <lament> er
18:10:31 <lament> these instructions are actually produced by GCC?
18:10:36 <calamari_> no
18:10:36 <lament> when compiling a printf?
18:10:39 <lament> there :)
18:10:46 <calamari_> I'm not using gcc
18:10:49 -!- kosmikus has changed nick to kosmikus|away.
18:10:51 <lament> what are you using?
18:11:04 <lament> the asm compiler would be not very interesting if you wouldn't be able to use it to compile C to BF
18:11:45 <calamari_> gcc isn't the only way to compile c to asm.. I was writing my own c compiler
18:12:00 <lament> oh.
18:12:11 <calamari_> I realized that if I wrote an assembler, the c compiler would be a lot easier to do
18:13:35 <calamari_> besides, gcc doesn't really put much code at all for a printf.. it pushes the operands and calls printf
18:13:58 <calamari_> printf can do whatever you want.. that's handled during linking
18:15:58 <calamari_> but, I gave up trying to figure out the gcc backend. I'm sure there is documentation somewhere on how to do it, but I couldn't find any that I understood
18:48:17 <fizzie> meh, was writing my own '.,<>+-'-sequence-optimizer but managed to forget that ">,<." cannot be optimized to ".," really.
18:49:44 <fizzie> uh, I obviously mean ".>,"
18:50:41 <lament> fizzie: no! let me write it!! :)
18:52:07 <lament> although i'm not entirely sure how to do it.
18:53:25 <lament> Of course it has to be able to optimize ++++++, to ,
18:54:29 <fizzie> other than the IO-in-order problem I think a relatively clean way is to gather the strings of operations applied to every cell to an array, then optimize those and recreate a suitable >[ops]>[ops]-like thing. but that would happily transform >,<. to .>,
18:55:07 <fizzie> "optimize those" would mean at least "remove all +-s before a ," and "combine all series of +-s"
18:56:17 <lament> what are you writing it in?
18:57:30 <fizzie> well, I wrote few lines (80) in C but I'm not sure whether I want to think about the IO ordering. maybe I'll indeed let you write it.
18:58:51 <lament> :)
18:59:22 <lament> my 72-line python program optimizes +-<> sequences.
18:59:37 <lament> i'll probably have to rewrite it from scratch though :|
19:00:44 <lament> but really, it should be written in Brainfuck.
19:00:50 <lament> The trick is to find a good algorithm.
19:05:08 <calamari_> yay, bfasm parses the instructions and operands.. now to do the hard work of generating bf code
19:10:17 <lament> Ooh, i think i came up with an algorithm.
19:10:51 <lament> implementing should be trivial now.
19:11:35 <lament> it's almost easier than my original implementation.
19:44:21 * lament is stumped
19:44:24 <lament> <+>>+<
19:45:10 <lament> correction
19:45:14 <lament> <+>>>+<<
19:45:29 <lament> >>+<<<+>
19:45:30 <lament> ...
19:45:32 <lament> wicked.
20:16:52 <lament> woohoo!
20:16:54 <lament> i think i wrote it
20:17:05 <Taaus> Show us the source!
20:17:07 <lament> er
20:17:11 <lament> no, i haven't :)
20:19:07 <lament> ok, i think i have now.
20:19:24 <lament> Can you give me some +-,.<> sequences to optimize? :)
20:20:02 <lament> gah more bugs
20:20:55 <lament> :(
20:21:17 <Taaus> How does it optimise ">>>>,<<"?
20:21:39 <lament> you can't optimize that.
20:21:52 <calamari_> ,+[-.,+]
20:23:25 <calamari_> hmm cool, if eof=0 then it's ,[.,]
20:24:01 <calamari_> never thought of that before.. dunno why :)
20:24:05 <lament> ok, now it's definitely done
20:25:24 <lament> give me sequences! :)
20:25:41 <lament> fuck.
20:25:54 <calamari_> >++.>+.+++++++..+++.>++.<<++++++++++++
20:25:55 <calamari_> +++.>.+++.------.--------.>+.>.
20:26:00 <calamari_> oops
20:26:19 <calamari_> >++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
20:26:33 <calamari_> it shouldn't be able to do anything with that
20:31:35 <lament> give me better sequences
20:31:40 <calamari_> lol
20:31:47 <calamari_> did it stay the same?
20:32:55 <calamari_> ,,,,,
20:33:05 <lament> ...
20:33:11 <lament> well actually
20:33:37 <lament> yeah. blah.
20:33:43 <lament> None of them got any shorter.
20:33:50 <calamari_> good
20:34:06 <lament> FUCK
20:34:13 <lament> I just accidentally deleted the source.
20:34:19 <lament> :)))))))))))))))))))))))))))))
20:35:12 <calamari_> really?
20:35:26 <calamari_> hope you're using fat/fat32 .. undelete :)
20:36:00 <lament> ext2
20:36:40 <lament> phew
20:36:45 <lament> i had vim open in another window
20:36:54 <lament> with that file
20:37:27 <lament> it's safe.
20:42:23 <calamari_> +++.---
20:43:02 <calamari_> +-+.-+-
20:43:19 <lament> more bugs though :|
20:45:01 -!- calamari- has joined.
20:54:13 <lament> this needs a rewrite anyway.
21:03:04 <lament> ok
21:03:07 <lament> i think _now_ i did it.
21:03:49 <lament> it's much simpler now too.
21:04:45 <lament> also broken.
21:04:47 -!- calamari_ has quit (Read error: 110 (Connection timed out)).
21:05:25 <lament> crap.
21:05:46 <lament> crap, crap.
21:08:15 <lament> crap.
21:15:37 <lament> ok
21:15:43 <lament> it better work now!!!
21:16:08 <fizzie> there's a nice ook-like bf "variant": crap! "crap. crap. crap? crap! crap! crap?"
21:17:22 <lament> yeah.
21:17:38 <lament> but i'm _sure_ i got it working now.
21:17:39 <lament> :)
21:18:54 <lament> ... and i'm still wrong :(
21:19:53 <lament> I hate programming.
21:20:09 <calamari-> lament: do you have bfbasic? I'd be curious to know what your program does with some of the compiled examples
21:20:18 <calamari-> or I can dcc
21:20:36 <calamari-> actually, nm.. it can't do [] yet
21:22:52 <calamari-> bbl.. work
21:22:53 -!- calamari- has quit ("Leaving").
21:58:05 <lament> :[
22:07:47 <lament> graah
22:07:53 <lament> i thought i have a bug
22:07:58 <lament> but actually i don't
22:08:12 <lament> oh the humiliation.
22:08:16 <fizzie> no bug for you, lament!
22:08:26 <lament> well, now i'm _damn sure_ i'm done :)
22:08:37 <fizzie> just like the last N times?
22:08:49 <lament> no.
22:08:52 <lament> those times, the bugs were real.
22:09:03 <lament> give me a sequence! :)
22:10:17 <fizzie> well uh I haven't written much befunge, and this hw2.bf (t-106.231 course homework) doesn't seem to have any long sequences to optimize.
22:10:37 <lament> it's a brainfuck, not befunge, optimizer
22:10:56 <fizzie> hw2.bf is brainf*ck.
22:11:00 <fizzie> I use .bef for befunge.
22:11:09 <lament> 14:10 <fizzie> well uh I haven't written much befunge,
22:11:21 <fizzie> well, that just means my brain is misfired.
22:11:24 <lament> what does hw2.bf do?
22:11:31 <fizzie> miswired. gah.
22:11:52 <fizzie> converts ascii-binary to ascii-decimal, I think. something like that anyway.
22:12:13 <fizzie> actually it converts ascii-binary to "real binary" (single brainf*ck cell) and then prints that as decimal.
22:12:18 <fizzie> a short four-line ditty.
22:12:42 <lament> paste it!
22:13:16 <fizzie> it's not very nice brainf*ck, I think.
22:13:21 <fizzie> +[>,----------[>++++++[<------>-]<-->>[->++<]>[-<+>]<<<[>>+<<[-]]<+>]<-]>>>
22:13:22 <fizzie> >>>++++++++++>+<<<<[>>>>>+[->>+>+<[<<+>>-]<<[>+>+<<-]++++++++++>[<->-]<[[-]>>+++
22:13:26 <fizzie> +++++++>>-<<<<]>>---------->>+]+[-<<[<<+>>-]<<[>+>+<<-]>----------[<+>[+]]<]<-]>
22:13:29 <fizzie> >>>->>>>[>>>>]<<<<[<<++++++[>++++++++<-]>.<<<]++++++++++.
22:13:30 <fizzie> plus that might be the buggy version too.
22:13:43 <fizzie> the printer didn't like '0's.
22:14:09 <fizzie> I have a non-buggy version too, but I'm not quite sure where.
22:15:14 <fizzie> first line is the 'read ascii binary' line, last three are an ugly "print as decimal" routine.
22:15:55 <fizzie> uses lots of cells too, something like 3*decimal-digits or 4*decimal-digits of the number.
22:16:54 <lament> ok, you're right.
22:17:08 <lament> the optimizer does nothing of interest.
22:17:28 <lament> apart from rearranging the code to its liking.
22:17:55 <fizzie> well yeah, I see no reason to write unoptimized ><+-,. sequences when writing code manually. :p
22:19:48 <lament> you could do it accidentally.
22:20:08 <fizzie> I see no reason to make mistakes.
22:21:18 <lament> heh.
22:21:29 <lament> heh.
22:21:41 <lament> Compared to my +-<> optimizer, this thing is almost useless.
22:22:15 <lament> wib.b (the brainfuck->c compiler) is 6288 instructions.
22:22:35 <lament> optimized +-<> it's 6098 instructions.
22:22:46 <lament> optimized +-<>,. it's 6092.
22:23:42 <lament> would be interesting to try it on calamari's generated code, though.
22:32:21 <lament> heh.
22:32:25 <lament> it's surprisingly efficient.
22:32:30 <lament> (calamari's bfbasic)
22:33:56 <fizzie> next optimize .,<>+-[] strings.
22:34:26 -!- Toreun has quit (Read error: 104 (Connection reset by peer)).
22:34:27 <fizzie> to provably shortest possible equivalent code.
22:34:39 <lament> :)))
22:34:40 <lament> Right.
22:34:52 <lament> Now, there's just the simple matter of that being impossible.
22:35:00 <fizzie> excuses.
22:35:07 <fizzie> just write some python code to do it.
22:35:17 <fizzie> I hear python makes the impossible possible.
22:36:46 <lament> true.
22:40:56 <lament> hm
22:41:05 <lament> optimizing -+,.<>[] is of course impossible.
22:41:11 <lament> but what about -+,.<>[ ? :)
22:46:18 <lament> hahaha
22:47:14 <lament> the optimized version of 99 bottles produces _longer_ binary when compiled with bfc
22:48:16 <lament> (although the C code is of equal size for both)
23:07:11 -!- mooz- has quit (calvino.freenode.net irc.freenode.net).
23:07:11 -!- fizzie has quit (calvino.freenode.net irc.freenode.net).
23:07:11 -!- deltab has quit (calvino.freenode.net irc.freenode.net).
23:07:11 -!- Taaus has quit (calvino.freenode.net irc.freenode.net).
23:07:13 -!- cmeme has quit (calvino.freenode.net irc.freenode.net).
23:07:14 -!- ChanServ has quit (calvino.freenode.net irc.freenode.net).
23:07:15 -!- mtve has quit (calvino.freenode.net irc.freenode.net).
23:07:15 -!- kosmikus|away has quit (calvino.freenode.net irc.freenode.net).
23:07:40 -!- edwinb has quit (calvino.freenode.net irc.freenode.net).
23:07:45 -!- ChanServ has joined.
23:07:45 -!- edwinb has joined.
23:07:45 -!- kosmikus|away has joined.
23:07:45 -!- mtve has joined.
23:07:45 -!- cmeme has joined.
23:07:45 -!- mooz- has joined.
23:07:45 -!- Taaus has joined.
23:07:45 -!- deltab has joined.
23:07:45 -!- fizzie has joined.
23:07:45 -!- irc.freenode.net has set channel mode: +o ChanServ.
23:35:56 -!- Toreun has joined.
←2004-06-10 2004-06-11 2004-06-12→ ↑2004 ↑all