00:00:44 that is equivalent 00:00:50 essentially 00:00:55 Tell me whether or not this Haskell program halts: main = print $ head $ filter perfect [1,3..] where perfect x = sum (divisors x) == x; divisors x = [ y | y <- [1..x-1], x `mod` y == 0 ] 00:01:07 Or the program I meant to write, if that isn't the right one :-P 00:01:39 well, we know it's impossible, so this is stupid 00:02:13 Yeah. 00:02:42 true, but this shows that the halting problem is somewhat connected to the existence of undecidable theorems 00:02:45 what about programs that don't use halt 00:03:40 the proof on wikipedia uses halt on a program that uses halt 00:04:12 If Turing-machines can solve the halting problem, then "Turing machines that don't use halt" isn't Turing-complete. 00:04:26 i know 00:04:59 although i rather suspect that "this program uses halt" is undecidable, or even undefinable 00:05:22 -!- ihope_ has joined. 00:05:32 because you cannot decide whether a program is equivalent to halt 00:05:44 But since Turing machines can't solve the halting problem, "Turing machines that don't use halt" is simply all Turing machines. :-) 00:05:46 (even assuming it exists) 00:06:59 who proved that two lambda expressions couldn't be proven equivalent? 00:07:41 don't remember, let me see in wikipedia 00:09:10 Church 00:09:18 ah, it's Rice's theorem 00:09:35 ok maybe Church proved a special case 00:19:19 Isn't that equivalent to the halting problem? 00:19:55 Also, \x.x and \x.xx can't be proven equivalent. Q.E.D. 00:20:17 it's proven by reduction to the halting problem. 00:20:29 see the wikipedia page 00:21:13 well in _that_ case it was the Church-Rosser theorem. 00:21:49 which showed that _some_ expressions couldn't be proved equivalent 00:22:58 -!- ihope has quit (Read error: 110 (Connection timed out)). 00:23:19 i thought you meant who proved that it couldn't be decided whether two given expressions were equivalent 00:23:57 (as in being the same function) 00:27:16 ...What? 00:27:28 what what? 00:27:38 How many definitions of equivalence are there? 00:27:57 five 00:28:06 bannana-grape 00:28:08 there is beta equivalence, beta/eta equivalence 00:28:36 but the Church-Rosser theorem is needed to prove each of them consistent 00:29:05 without it, maybe \x.x and \x.xx _could_ be turned into each other 00:29:09 bsmntbombdood: bananas and grapes are obsolete. Please upgrade to Cantor normal form. 00:29:15 :-P 00:29:22 cantor normal form? 00:29:47 cantor normal form is essentially positional notation in base omega 00:30:17 omega^(omega+1) + omega^1*3 + omega*3 + 5, for example 00:30:41 eh, *omega^2*3 00:30:51 Like polynomials, sort of. 00:31:00 whoosh 00:31:20 omega^a*b + omega^c*d + omega^e*f... 00:31:34 omega = the ordinal of the natural numbers, the first infinite one 00:31:41 Where a, c, e, etc. are ordinal numbers and b, d and f are natural numbers. 00:31:57 Bananas and grapes form a subset of the ordinal numbers, I mean. 00:32:32 up to omega*2, isn't it? 00:32:46 Something like that. I don't know. 00:33:50 as in, the bananas are the first omega ordinals and the grapes the next omega ordinals 00:33:59 or maybe it was the other way around 00:34:23 The other way around, I think. 00:35:08 Also, ordinal numbers aren't cardinal numbers. :-) 00:35:34 of course. 00:36:35 (when you know it) 00:37:55 Obvious iff you already know. 00:38:50 well, it doesn't take _that_ long to realize that omega+1 and omega have the same cardinality 00:38:55 .... 00:39:03 none of this makes any sense to me. 00:39:04 at all. 00:39:08 me too 00:39:30 hm... 00:39:38 Essentially, an ordinal number is what I tried to get at with grapes and bananas. 00:40:06 do you know what a total order is? 00:40:17 Me? 00:40:19 grapes and bannanas? 00:40:23 no the others 00:40:33 ooooh 00:40:37 bsmntbombdood: you're the one who said banana-grape. :-P 00:40:41 ordinal - the contents of a set. 00:40:44 i assume you know since you know what ordinals are 00:40:44 cardinal - the size of a set 00:40:59 not quite 00:41:12 ihope_: i was just talking about fruit 00:41:18 ordinal = the order type of a (well-) ordered set 00:41:54 Informally, an ordinal number is a set of ordinal numbers such that each of its elements' elements is an element. 00:42:10 ... 00:42:11 Examples: 0 is defined as the empty set, 1 as {0}, 2 as {0,1}, 3 as {0,1,2}, etc. 00:42:13 that's even more confusing 00:42:22 the von Neumann ordinals 00:42:27 Not if you have no idea what an order type is :-P 00:42:28 that's a recursive definition 00:42:33 Well, yes, it is. 00:42:36 an ordinal number is a set of ordinal numbers... 00:42:42 {0,{0}}? 00:42:47 bsmntbombdood: yep. 00:42:51 {0,{0,{0}}}? 00:42:57 what's the point? 00:43:07 {0,{0},{0,{0}}}. 00:43:09 I just failed Algebra 2... to give you an idea of my current level of math skills. 00:43:15 ouch 00:43:18 I haven't even touched set theory... besides what I've read of it. 00:43:22 ouch 00:43:31 ihope_: what's that? 00:43:33 The point is that you have infinite ordinal numbers as well: omega, the first infinite ordinal number, is {0,1,2,3,4,5,6,7,8...} 00:43:34 well... that was from laziness. 00:44:38 kinda like church numerals 00:44:45 Then the next ordinal number, omega+1, is {0,1,2,3...omega}, and omega+2 is {0,1,2,3...omega, omega+1}, omega+3 is {0,1,2,3...omega, omega+1, omega+2}. 00:45:11 that doesn't make sense 00:45:15 omega+omega or omega*2, then, is {0,1,2,3...omega, omega+1, omega+2, omega+3...} 00:45:33 yeah - they are used in set theory to get the natural numbers in the same way that church numerals are used to get them in lambda calculus 00:45:47 bsmntbombdood: is there a certain part of it that doesn't make sense, or is it just generally confusing? 00:46:04 the omega part 00:46:51 Well, omega is what you get when you go past all the natural numbers. 00:47:04 omega is the set of all the finite ordinals, itself infinite 00:47:08 what's this called so i can look it up? 00:47:14 An ordinal number contains all the ordinal numbers you've gone past. 00:47:25 bsmntbombdood: what's what called? 00:47:39 this ordinal-omega stuff 00:47:45 (transfinite) ordinal numbers 00:48:04 ok i have to go to dinner 00:48:38 btw there is a trick to remove the recursivity from the definition 00:49:21 An ordinal number is a set whose elements are subsets of it, and which is totally ordered under the "is an element of" operation. 00:50:29 i think you may want well-ordered 00:51:09 Totally ordered is sufficient, isn't it? 00:51:20 or maybe not - you get that from the axiom of foundation 00:52:34 -!- sebbu has quit ("@+"). 00:53:14 i think it is sufficient but using well-ordered allows you not to bother with things like x = {x} 00:53:17 You mean the axiom of foundation has a use? 00:53:48 yep, without it x = {x} would be an ordinal by your definition 00:54:51 Wouldn't x = {x} be well-ordered anyway? 00:55:04 eh - good point 00:55:52 so you actually need to assume explicitly that x is well-founded 00:56:14 if you don't have the axiom of foundation 00:56:29 in which case total probably suffices for the order 01:02:03 -!- nazgjunk has quit ("Bi-la Kaifa"). 01:33:31 * SimonRC reads up 01:35:16 * SimonRC decides that if he had a mutant power, he would be a Turing Oracle. 01:35:28 (able to predict if any give Turing Machine halts) 01:38:58 Hmm, bananas and grapes.... http://www.catb.org/jargon/html/O/one-banana-problem.html 01:39:16 This, naturally, would permit you to find out whether any mathematical hypothesis is a theorem, and by binary search to find its proof. 01:39:57 SimonRC: I've seen that before... :-) 01:40:07 read that whole website!!!!!! 01:40:22 I want to be a Turing Oracle... 01:40:57 failing that, you *really* must read appendix B: http://www.catb.org/jargon/html/appendixb.html 01:41:04 appendix A rocks too 01:41:21 oerjan: yeah, fun 01:42:29 actually... there might be some problems if the length of the proof is described with the Ackermann function :) 01:42:54 which certainly must be true for some theorems 01:43:07 Hmm... 01:43:18 BTW, I can't see how to express that puzzle about whether "f n = if even n then f (n/2) else f (n*3+1)" always hits one for eveny starting Natural n as a halting problem 01:43:41 Give me a series of theorems whose proofs are longer than the corresponding values of the Ackermann function. :-) 01:44:06 indeed, it would seem to be in the next grape or banana 01:44:17 incidentally, the busy-beaver numbers are uncomputable (in the genersal case) 01:44:18 SimonRC: n `div` 2, remember. 01:44:27 it is pseudocode 01:44:44 It does a remarkably good job of being Haskell. 01:44:59 :-P 01:45:19 the question of whether _one_ number halts on 3n+1 is a halting problem. 01:45:23 Haskell is almost pseudocode 01:45:40 There are programming languages much better than Haskell. 01:45:42 oerjan: indeed 01:45:46 ihope_: e.g.? 01:45:47 I just don't know of any. :-P 01:45:51 :-( 01:46:15 Well, no decently fast implementations for any. 01:46:57 So what are the slow ones? 01:47:02 I could take first-order logic, extend it to a programming language, and execute programs by brute force. 01:47:20 Brute-forcing proofs isn't very fast. 01:48:34 lessee, forall x exists n such that x_n = 1, the switch between forall and exists indicates that each loop may go up a level in the halting hierarchy 01:49:27 ah, this suddenly sound familiar from my compuability theory lectures 01:49:35 the "switch between forall and exists" part 01:49:44 Foralls and existses are nice. 01:49:46 yeah, it's the same as for the polynomial hierarchy 01:49:53 yeah, that thing 01:49:54 Also known as forsomes. :-) 01:49:58 fuck fuck fuck fuck fuck 01:50:08 excuse the language 01:53:07 * oerjan suddenly wonders if there is an esoteric language named SOAP 01:53:47 nah, just an operating system 01:53:48 SOAP is going to be a platform for an esoteric operating system, if people ever start following my orders. 01:54:12 oerjan: please throw dextrose tablets at bsmnt_bot. 01:54:12 when Malbolge freezes over, in other words 01:54:24 Pff, I can do that. 01:54:31 ...Wait... 01:54:44 dextrose? 01:54:58 The usable form of glucose. 01:55:11 ~exec sys.output("Give me sugar!") 01:55:22 ~exec sys.stdout("Give me sugar!") 01:55:22 Give me sugar! 01:55:36 * ihope_ throws dextrose tablets at bsmnt_bot 01:55:55 I have forgotten it _every_ time except once 01:56:05 :-) 01:58:40 ~exec sys.dlete("/") 01:58:46 *cough* 01:59:06 ~exec sys.delete("/") 02:05:35 I was deliberately not doing that 02:06:16 BTW, is doing (do + ing) supposed to be spelt the same as doing (onomatapoea)? 02:06:57 you _do_ know that ihope is easily tempted with bsmnt_bot. 02:07:41 no, the latter must be spelt dhoeyng'x 02:11:09 D'oing. 02:13:49 Darn. I want to be able to combine infinite cyclic datastructures with mutable references in Haskell. 02:15:48 * ihope_ throws dextrose tablets at oerjan 02:16:08 yummy 02:16:18 IORef! 02:16:21 Or is it IOref? 02:16:47 i know, but it doesn't quite work 02:17:46 i cannot get an IO action to refer cleanly to an IORef which is defined later 02:18:16 I see. 02:19:29 unsafeInterleaveIO gives infinite datastructure of mutable references but not cyclic ones 02:20:24 and unsafePerformIO has badly defined semantics 02:31:38 what about bsmnt_bot ? 02:31:50 ihope_: you fale 02:32:07 ~exec throw(dextrose_tablets, bsmntbombdood) 02:32:13 Darn. 02:32:38 ~exec raise "Dextrose_tablets", "smntbombdood" 02:33:08 ~exec def self.dextrose(x): raw("PRIVMSG #esoteric :\001ACTION throws dextrose tablets at %s\001" % x) 02:33:15 Pff. 02:33:29 ~exec self.dextrose = lambda x: bot.raw("PRIVMSG #esoteric :\001ACTION throws dextrose tablets at %s\001" % x) 02:33:42 ~exec self.dextrose("bsmntbombdood") 02:33:43 * bsmnt_bot throws dextrose tablets at bsmntbombdood 02:33:52 * ihope_ throws dextrose tablets at bsmnt_bot 02:33:55 Not bad. 02:34:14 why the obbsesion with dextrose? 02:36:50 now they tell me at #haskell there is a fixIO. 02:42:02 A what? 02:42:05 esr is crazy 02:42:08 * ihope_ throws dextrose tablets at bsmntbombdood 02:43:42 fixIO :: (a -> IO a) -> IO a 02:44:00 to make cyclic IO actions depending on their result 02:44:48 cps is weird 02:45:00 also used with the mdo recursive monad notation 02:46:20 * oerjan invents sinistrose 02:47:24 being the opposite of dextrose. 02:48:13 mdo? 02:48:20 Like do, except with monads? 02:48:51 do is with monads 02:49:10 mdo vs. do is like letrec vs. let in scheme 02:49:48 I know nothing about Scheme. 02:50:03 scheme pwns haskell 02:50:47 in do, variables introduced with <- can only be used in later statements. in mdo they can be used in the whole mdo statement 02:50:57 *variables = bindings 02:51:22 I now know one thing about Scheme. 02:51:43 no you don't 02:51:48 Oh. 02:52:08 bsmntbombdood is lying :) 02:52:19 code as data, man! 02:52:21 Also, I take it this doesn't work: mdo {putStrLn x; x <- getLine} 02:52:38 bsmntbombdood: :-P...wait, what? 02:52:44 * ihope_ ponders 02:52:50 what? 02:52:54 data as code dude! 02:53:00 that's why scheme is better than haskell 02:53:04 * ihope_ decides "data as code" was... darn, SevenInchBread beat me to it 02:53:12 nope, that would hang 02:54:25 Well... Lisp homoiconicity makes "data as code" as well. 02:54:28 it works both ways. 02:54:42 yeah 02:54:50 sexp! 02:54:57 since Lisp code is just like... a parse tree. 02:56:18 sexp 02:59:36 zzzzz 02:59:39 * SimonRC goes to bed 03:01:50 oerjan: look at "mdo". It is sugar that works on any instance of MonadLoop (i.e. most Monads). 03:02:01 oh, wait, you did 03:02:55 (> scheme haskell) 03:03:33 LISPoids: code is data. Haskell: computations are data 03:03:40 notice the difference 03:03:44 anyway 03:03:46 Scheme == Haskell 03:03:46 zzzzzzz 03:04:01 (> scheme) haskell 03:04:08 :-D 03:04:08 lol 03:04:10 zzzzzzz 03:04:22 sex-pee 03:04:32 Oh dear. 03:04:49 Isn't that that... stuff? 03:05:05 ? 03:05:16 what stuff 03:05:31 (> scheme haskell) <== sex-pee 03:05:46 Eew. 03:06:01 (> scheme) haskell <== sex-tion 03:07:03 '(...) <=== sex-pee 03:07:27 original LISP with mex-pees was ugly 03:07:56 ihope_: s-expression 03:07:58 s-exp 03:08:00 sexp 03:08:04 sex-pee 03:13:39 mccarthy the urophiliac 03:25:24 -!- ihope_ has quit (Connection timed out). 03:42:09 -!- oerjan has quit ("leaving"). 04:03:43 -!- RodgerTheGreat has quit. 05:18:41 -!- ShadowHntr has joined. 05:24:29 -!- RodgerTheGreat has joined. 05:29:56 -!- RodgerTheGreat has quit (Read error: 113 (No route to host)). 05:30:53 -!- calamari has quit (zelazny.freenode.net irc.freenode.net). 05:30:53 -!- oklopol has quit (zelazny.freenode.net irc.freenode.net). 05:30:53 -!- GregorR has quit (zelazny.freenode.net irc.freenode.net). 05:30:53 -!- SimonRC has quit (zelazny.freenode.net irc.freenode.net). 05:30:53 -!- sekhmet has quit (zelazny.freenode.net irc.freenode.net). 05:30:53 -!- tokigun has quit (zelazny.freenode.net irc.freenode.net). 05:31:37 -!- RodgerTheGreat has joined. 05:31:57 -!- calamari has joined. 05:31:57 -!- oklopol has joined. 05:31:57 -!- GregorR has joined. 05:31:57 -!- SimonRC has joined. 05:31:57 -!- tokigun has joined. 05:31:57 -!- sekhmet has joined. 05:33:38 -!- RodgerTheGreat_ has joined. 05:33:52 -!- RodgerTheGreat has quit (Read error: 104 (Connection reset by peer)). 05:34:53 -!- RodgerTheGreat_ has quit (Client Quit). 05:35:57 -!- RodgerTheGreat has joined. 05:36:03 -!- RodgerTheGreat has quit (Client Quit). 05:37:19 -!- RodgerTheGreat has joined. 05:40:22 -!- RodgerTheGreat has quit (Client Quit). 05:41:12 -!- RodgerTheGreat has joined. 05:44:11 -!- RodgerTheGreat has quit (Client Quit). 06:02:36 -!- digital_me has quit (Connection timed out). 06:18:33 -!- calamari has quit ("Leaving"). 06:25:13 -!- ShadowHntr has quit (Connection timed out). 06:52:29 -!- SevenInchBread has quit (Read error: 113 (No route to host)). 07:05:19 -!- Sgeo has quit (Read error: 104 (Connection reset by peer)). 07:05:25 -!- anonfunc has joined. 07:59:59 -!- clog has quit (ended). 08:00:00 -!- clog has joined. 09:12:27 -!- sebbu has joined. 10:56:01 -!- jix has joined. 10:58:18 -!- sebbu2 has joined. 11:06:39 -!- sebbu has quit (Read error: 60 (Operation timed out)). 11:10:14 -!- puzzlet has quit (Remote closed the connection). 11:11:22 -!- puzzlet has joined. 11:23:38 -!- anonfunc has quit (Read error: 60 (Operation timed out)). 11:35:15 -!- anonfunc has joined. 11:56:02 -!- helios24 has joined. 12:03:18 -!- nazgjunk has joined. 12:08:14 -!- ihope_ has joined. 12:08:24 -!- ihope_ has changed nick to ihope. 12:16:48 -!- tgwizard has joined. 12:22:59 -!- nazgjunk has quit (Read error: 104 (Connection reset by peer)). 12:23:20 -!- nazgjunk has joined. 12:37:35 -!- nazgjunk has quit (Read error: 104 (Connection reset by peer)). 12:37:40 -!- UpTheDownstair has joined. 12:38:08 -!- UpTheDownstair has changed nick to nazgjunk. 12:44:57 -!- sebbu has joined. 12:50:01 -!- sebbu2 has quit (Read error: 60 (Operation timed out)). 14:15:42 -!- helios24 has quit ("Leaving"). 15:38:30 -!- UpTheDownstair has joined. 15:38:47 -!- UpTheDownstair has quit (Read error: 54 (Connection reset by peer)). 15:55:45 -!- nazgjunk has quit (Read error: 110 (Connection timed out)). 15:57:48 -!- SevenInchBread has joined. 16:04:31 -!- nazgjunk has joined. 17:03:29 -!- flagitious has joined. 17:18:33 -!- RodgerTheGreat has joined. 17:19:03 -!- RodgerTheGreat_ has joined. 17:27:30 -!- RodgerTheGreat has quit (Read error: 60 (Operation timed out)). 17:27:54 -!- RodgerTheGreat_ has changed nick to RodgerTheGreat. 18:34:16 -!- ihope has quit (Read error: 110 (Connection timed out)). 19:12:23 -!- ihope_ has joined. 19:12:35 -!- ihope_ has changed nick to ihope. 19:22:47 -!- SevenInchBread has quit (Read error: 110 (Connection timed out)). 19:29:28 -!- digital_me has joined. 20:05:08 -!- GregorR has changed nick to _D6Gregor1RFeZi. 20:17:38 * ihope throws dextrose tablets at _D6Gregor1RFeZi 20:18:28 -!- SevenInchBread has joined. 20:30:57 -!- ShadowHntr has joined. 21:01:30 -!- sebbu2 has joined. 21:20:17 -!- sebbu has quit (Connection timed out). 21:23:16 -!- Arrogant has joined. 21:34:38 -!- oerjan has joined. 21:47:47 * oerjan still wonders what the dextrose tablets are about. 21:48:14 <_D6Gregor1RFeZi> Same 'ere. 21:48:40 <_D6Gregor1RFeZi> Presumably they're placebos, but maybe I'm supposed to believe that they'll demangle me. 21:48:41 ~exec self.dextrose(" oerjan ") 21:48:42 * bsmnt_bot throws dextrose tablets at oerjan 21:48:57 wow 21:49:44 well dextrose is not a placebo when it comes to energy 21:50:21 ~exec self.dextrose(" _D6Gregor1RFeZi ") 21:50:21 * bsmnt_bot throws dextrose tablets at _D6Gregor1RFeZi 21:50:35 Why the spaces? 21:50:41 tabe completion 21:50:42 ~exec self.dextrose("_D6Gregor1RFeZi") 21:50:42 * bsmnt_bot throws dextrose tablets at _D6Gregor1RFeZi 21:50:53 Oh. 21:52:02 -!- Arrogant has quit ("Leaving"). 21:53:23 ~ctcp oerjan VERSION 21:54:11 hm... did anything happen? 21:54:28 yeah 21:54:42 i didn't see any incoming ctcp 21:54:44 :orwell.freenode.net 505 bsmnt_bot :Private messages from unregistered users are currently blocked due to spam problems, but you can always message a staffer. Please register! ( http://freenode.net/faq.shtml#privmsg ) 21:54:53 oh. 21:55:00 anyhow i'm on irssi too 21:56:12 what is the tab character in html? :P 21:56:47 ~exec sys.stdout(r"^ *(.*[^ ]) *$" % " testing ") 21:57:22 -!- Sukoshi has joined. 21:57:33 Hey y'all. 21:57:36 long time no see Sukoshi 21:57:41 I know. 21:57:43 :) 21:57:56 Any Lex/Yacc wizards here? 21:58:01 Or, just Lex/Yacc users? 21:58:09 I've used em before 21:58:20 i have tried it 21:58:24 Can you use ( ) as grouping to group | ? 21:59:57 doesn't seem like it from "info bison" 22:01:48 Is it BNF? 22:02:00 Because I want to specify the exact repititions of something. 22:02:21 i guess that doesn't work because there would be no uniform way to refer to the matched tokens 22:03:50 you'll just have to define some helping tokens 22:04:25 I'm writing a parser for the BT bencoding, by the way. 22:05:00 i don't remember that one 22:05:12 I'll link it, and my Yacc file. 22:05:31 If you'd be so kind as to take a look at it and confirm if it would match correctly. 22:07:46 If this doesen't work, I write it myself. It's faster/less headache. 22:07:57 Woe to the not-pointer-arithmetic-endowed then. 22:08:16 pointer arithmetic is fun 22:08:25 I know, but not everyone can follow it. 22:08:44 That's why I'm choosing to use yacc/lex. 22:10:05 as far as i understand, | just defines a new rule with the same left side 22:10:26 It also works as or. 22:10:34 a | b != | a b 22:11:11 well that's what i said 22:11:46 a | b are two separate rules, not an expression 22:12:02 Oh, I see. Yeah. 22:12:50 basically it has to be this way because otherwise $1 ... $n would not refer to well-defined tokens in the rule action 22:13:05 Uggh. Now I have to decide how the C code works with the grammar. 22:13:11 that's my guess anyhow 22:13:51 where is that link you promised? 22:14:01 Well, my grammar is written up. 22:14:08 But, I have to add C code to it now. 22:15:23 http://www.anysize.org/~sukoshi/benc_parse.l http://www.anysize.org/~sukoshi/benc_parse.y 22:15:35 Havas unun bonan tempon kun tiujun. 22:15:38 *tiujn 22:16:10 *Havos :P 22:16:50 Dankas vin. (Maybe.) 22:17:03 Estas mian plezuron. 22:17:08 ? 22:17:24 what's this a parser for 22:17:29 If I got that correct it was nearly pure luck 22:17:32 Bencoding data. 22:17:38 oerjan: The ``vin'' is superfluous. 22:18:32 -!- _D6Gregor1RFeZi has changed nick to _ZN6Gregor1REd. 22:18:53 http://wiki.theory.org/BitTorrentSpecification <-- Read. 22:18:55 torrents? 22:18:59 Yeah. 22:20:09 -!- _ZN6Gregor1REd has changed nick to GregorR. 22:20:30 there's no benc_int 22:20:44 Guh. I knew I missed something. 22:21:25 benc_int: BEGINT NUMBER END ; 22:21:54 also you don't do anything with the values 22:22:14 Well, my grammar is written up. But, I have to add C code to it now. 22:22:25 oh 22:22:40 yacc should build a parse tree implicitly to give to you after parsing 22:22:52 that STRDATA rule is going to break I think. 22:23:15 yeah 22:23:25 Then I need to delimit it. 22:23:33 because it is confused with anything else 22:23:45 i don't quite see why you need a lex stage 22:24:09 I guess. 22:24:10 hm... scratch that. 22:24:28 yacc needs a lexer 22:24:30 But I would like to make yytext a union later on. 22:24:38 Oh? 22:26:13 i'm interested to see how to use that parser 22:26:16 the length-encoding of strings doesn't fit into a regular language definition, or context-free for that matter. 22:26:30 A custom parser then? 22:27:48 i am sure there is some lex rule to gulp up a fixed number of characters 22:27:59 *rule=method 22:28:31 but you need to take the number:string parsing entirely in lex 22:28:42 yeah 22:28:56 Oh, I see. 22:29:09 a string will eat up the rest of the input 22:29:10 which shouldn't be too difficult 22:29:52 Wait. How would you suggest I do this? 22:30:07 If I don't return the NUMBER token, then the grammar can't use NUMBER. 22:30:33 -!- jix has quit ("Bitte waehlen Sie eine Beerdigungnachricht"). 22:31:16 you don't need the yacc stage to know that number:string has a substructure 22:31:34 Oh, durr. 22:31:41 how would you do that? 22:32:02 so just remove NUMBER and let STRING be the whole thing 22:32:13 or STRDATA 22:32:16 But true, how would you do it? 22:32:51 regexes can't match stuff like that 22:36:43 you can use the input() directive. 22:38:03 Can you give me an example? 22:38:20 what, input() reads characters in? 22:38:54 yep, so you could use a for loop with input() to read the required number of characters into a buffer 22:39:09 Exmpl plz :P 22:39:22 read() 22:40:02 no 22:40:09 i don't see any read() in the flex info 22:40:20 i was mistaken 22:40:33 "input Reads a byte from yyin" 22:40:46 Wait, are we still talking about parsing BT strings here? 22:40:56 yea 22:40:57 that's the idea 22:41:02 hmm 22:41:08 I would use a monadic parser for that 22:41:18 but yacc doesn't do monadic parsers 22:41:35 so you have [0-9]+: as the regex, then read in the correct number of bytes with input() 22:41:56 right 22:42:27 Where does the call to input() go? Lexer? 22:42:31 yeah 22:42:44 Now a better question: Why the hell did they invent their own data encoding rather than using a standard one? 22:42:56 like what? 22:42:58 Their bencoding is brain-damaged. 22:43:12 I can see they have there a subset of the functionality of ASN.1 22:43:27 There are plenty of tools that will spit out very fast ASN.1 parsers 22:44:11 It has such amazing features as being able to send the start of some data before knowing how long it is. 22:44:15 My theory is that it was a quick hack in Python. 22:44:45 meh 22:45:11 it would be a quick hack with Parsec :) 22:46:51 there might be another way to do it using yymore() and states 22:50:34 *states=start conditions 22:50:54 parsing is screwed up 22:51:50 oh wait. 22:52:06 the i lex rule also needs to include the number 22:52:40 no it doesn't 22:53:19 yes it does, otherwise there will be no way for lex to distinguish the number from the start of a string encoding 22:53:34 it doesn't need to 22:53:57 yes it must because it has to handle the string encoding specially 22:54:10 wait... 22:54:15 yacc just needs the tokens 22:54:41 it _could_ distinguish a number according to whether it is followed by : 22:54:48 yeah 22:55:11 but lex does need to know the length of the string somehow 22:56:00 -!- tgwizard has quit (Remote closed the connection). 22:56:14 including it in the i rule would cause earlier error detection 22:56:44 in the case of something like i100: 22:56:51 error detection is for pussies 22:57:48 in any case i end up with the feeling this grammar is far too simple for lex/yacc use, especially when it doesn't fit directly 22:58:22 -!- nazgjunk has changed nick to na[zZz]gjunk. 22:58:36 recursive descent and a switch statement might even be shorter 22:59:07 *would almost certainly be shorter 23:01:35 in fact it is practically designed to be trivial in that way 23:01:56 what's that? 23:02:37 just a simple: read the next character, switch on it to decide what to do 23:02:51 oh, yeah 23:03:20 would be pretty simple 23:08:11 * bsmnt_bot throws dextrose tablets at bsmntbombdood 23:10:54 one more thing - the lex parser doesn't handle negative numbers for i 23:22:24 methinks that a predictive parser would be what you wanted. 23:23:22 In fact, I suspect that bittorent was built before the protocol was properly written down, so there is certainly a simple parsing algorithm: that which is used by the original client. 23:24:37 -!- pikhq has joined. 23:25:18 hi 23:25:33 you are just in time for a predictive parsing vs. yacc flamewar 23:26:12 what's a predictive parser? 23:29:29 yacc is fine if your grammar is L(AL)R(1) but not LL(1) 23:29:56 but this one is nearly LL(1) at the character level 23:30:39 bsmntbombdood: a parser that always knows what token type will come next. 23:30:42 I think 23:30:46 read the Dragon Book 23:31:21 how is that possible 23:31:52 Correction: knows what token something is after reading the first subtoken 23:32:03 Hear ye, hear ye! Read the Wiki! 23:32:10 You will sound more competent & wise. 23:32:14 oerjan: maybe that, whatever 23:32:46 i.e. LL(1) if it is context-free 23:32:48 anyway, it is a subset of most other serious parser types 23:33:08 but Pascal can be parsed predictively IIRC 23:33:34 yes, Niklaus Wirth is known for making his grammars simple LL(1)-like 23:34:41 and in another note, these parsers/languages are usually the ones that one can create by hand without too much effort 23:34:55 using recursive descent 23:36:21 Ah, of course, pascal parsers were traditionally written in Pascal, weren't they? 23:37:02 i think so 23:37:39 i think Wirth's idea was that the grammar _should_ be simple enough to write a parser manually 23:38:13 but of course i am as usually using my vague memory to sound competent & wise :) 23:38:33 *usual 23:39:43 but then i have always enjoyed parser theory 23:39:52 * pikhq uses an external memory enhancement at times 23:40:31 how many years before Wikipedia plugs directly into the brain? 23:42:22 With Ratpoison and Conkeror, it's close enough already. 23:43:53 -!- sebbu2 has quit ("@+"). 23:45:54 -!- GregorR has changed nick to _D6Gregor1RFeZi. 23:48:21 Is that valid Malbolge, Gregor? 23:48:46 Fe is iron and Zi is zirconium, IIRC 23:51:29 i'm writing a bencode parser in python 23:52:12 Hexadeuterium monogregor monoR moniron monozirconide? 23:53:19 <_D6Gregor1RFeZi> :P 23:53:51 i can't figure out how to do lists without backing up 23:53:52 <_D6Gregor1RFeZi> Seems like an unlikely chemical forumula. 23:54:05 map (`mod` 94) $ zipWith (+) [0::Int ..] $ map (fromEnum) "_D6Gregor1RFeZi" 23:54:18 gives [1,69,56,74,24,12,15,24,28,58,92,81,19,9,25] 23:54:30 Yeah. 23:54:31 <_D6Gregor1RFeZi> Fascinating. 23:54:42 which means it is probably not legal Malbolge 23:54:44 Hmm. 23:55:00 It's *perfectly* valid Brainfuck, though. 23:55:08 Although it's equivalent to a null program. . . 23:55:09 <_D6Gregor1RFeZi> Doesn't do much though :P 23:57:19 <_D6Gregor1RFeZi> Nobody can guess what it is? :( 23:57:44 ok, got lists, it's ugly though 23:57:45 is it an esoteric language? 23:57:51 <_D6Gregor1RFeZi> Nope 23:58:44 i guess with the Gregor in it it is not a chemical formula either 23:59:02 <_D6Gregor1RFeZi> Nope 23:59:08 what is ugly? 23:59:17 It's Gregorium. 23:59:20 <_D6Gregor1RFeZi> Obviously none of you mess with name mangling much :P