--- Log opened Tue Mar 11 00:00:24 2008 |
00:01 | <@McMartin> | That said, check with your Lecturer. |
00:01 | <@McMartin> | If he has some kind of brain-dead autograder that assumes that it only needs to name a single source file, then his grading script will in fact require #including the .c files, since it will be too stupid to link anything. |
00:01 | <@McMartin> | If you get to turn in an executable with it, you're in better shape. |
00:02 | <@ToxicFrog> | Or if you get to turn in a makefile, or equivalent. |
00:02 | <+Molgorn> | He's an annoyingly vague bugger, so he just told us to turn in "whatever you think it takes to demonstrate that you have written a lexer and parser and that they work" |
00:03 | <@McMartin> | Right. Include the .exe along with the rest of it, and the dev-cpp project file |
00:03 | <@McMartin> | TF: dev-cpp doesn't use Make, but instead its own thingy. |
00:03 | <+Molgorn> | I'm going to give him bloody /everything/ |
00:03 | <@McMartin> | Yeah. Just include a binary in case he or his TA is too out of it or too ill-equipped to handle it. |
00:03 | <@ToxicFrog> | It doesn't? |
00:04 | <@McMartin> | TF: Not to my knowledge. At the very least. TW built a special build setup for Sable using it. |
00:04 | <@ToxicFrog> | It's been a while since I used it, but last time I checked the build backend worked by generating a makefile and then calling make |
00:04 | <+Molgorn> | all the source, all the gubbins, the executable, the inputs for the two test rigs, the expected outputs and a set of notes |
00:04 | <@McMartin> | "gubbins"? |
00:04 | <@McMartin> | (Also, Christ, if he's having you also provide the test cases, he's comically lazy.) |
00:05 | <@McMartin> | (Any sane grader would regularize the output and input sufficiently to let him try to surprise an assignment) |
00:05 | | Molgorn [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has quit [Connection reset by peer] |
00:07 | <@McMartin> | TF: OK then, Dev-CPP doesn't apparently consider a Makefile to be part of the project. |
00:07 | | Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has joined #code |
00:07 | < Moltare> | (Not having us so much as letting us if we take the effort to produce them. I'm not convinced he won't have his own set of really nasty ones.) |
00:07 | < Moltare> | blah |
00:07 | <@McMartin> | (Speaking again with my TA hat on, he'd damned well better) |
00:07 | <@ToxicFrog> | McMartin: I believe the makefile is regenerated from the project file + sources each time you change something, so no, it wouldn't be |
00:08 | | mode/#code [+v Moltare] by ChanServ |
00:08 | <+Moltare> | I don't see how he could mark it without having a set of tiers of nastiness and seeing which one breaks things ¬¬ |
00:09 | <@McMartin> | Can someone with acl access set Moltare to autoop or autovoice? |
00:09 | <@McMartin> | I actually set it up to exercise the spec thoroughly, and then started taking off points for minor/major/severe problems, with a dash of code review to keep them on their toes. |
00:10 | <+Moltare> | Kind offer, but after Wednesday I'll probably be around rather less. Until next time I'm asked to write something in a language I'm on the wrong course to have been taught, within the space of two weeks. |
00:12 | <@ToxicFrog> | Added ayways. |
00:13 | <@ToxicFrog> | And if you're anticipating needing to code again, it may be worthwhile to hang out in here anyways and listen in. |
00:17 | <+Moltare> | True, but the half of it is miles over my head ¬¬ |
00:17 | <+Moltare> | The rest merely hundreds of feet. |
00:35 | | JeffPL [80364597@Nightstar-9250.mibbit.com] has joined #code |
00:36 | < JeffPL> | Hello. |
00:36 | < JeffPL> | Anyone here who knows Python? |
00:37 | | * Vornicus is the local guru. |
00:39 | <@ToxicFrog> | Oh, Vorn. |
00:40 | <@ToxicFrog> | What the hell is with the *list syntax? |
00:41 | <@Vornicus> | Only works in calls and definitions |
00:42 | <@ToxicFrog> | Yes. |
00:42 | <@Vornicus> | What do you know of it already? |
00:42 | <@ToxicFrog> | My question is why list unrolling is a special construct rather than a library function, and why it overloads * |
00:42 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
00:43 | <@Vornicus> | it's a special construct because I don't think you could pull off a lib function that does it |
00:43 | <@ToxicFrog> | ...Python has multiple returns, right? |
00:43 | <@ToxicFrog> | Or do you have to use tuples for that? |
00:43 | <@Vornicus> | Multiple returns actually returns a tuple |
00:44 | <@ToxicFrog> | Aha. |
00:44 | <@ToxicFrog> | Ok, yeah, in that case it can't be a function, so that part makes sense. |
00:44 | <@Vornicus> | It overloads * because it feels like it, I don't know |
00:44 | <@Vornicus> | But then you also have ** which does the same thing with named arguments and dictionaries |
00:44 | < JeffPL> | I'm just having some weird trouble with a @tracing decorator. |
00:44 | <@Vornicus> | ah, I have never worked with @tracing |
00:44 | | Vornicus is now known as Finerty |
00:45 | <@ToxicFrog> | ** I have no real complaint with because that one definitely can't be a function, it needs to be either CTMP or a special construct |
00:45 | <@ToxicFrog> | Although, again, plz to stop with the random operator overloading |
00:46 | <@Finerty> | I think it's got something to do with the dereference operator from C |
00:49 | <@ToxicFrog> | Which has pretty much no relation to what * and ** actually do in python, so it's just confusing. |
00:49 | <@ToxicFrog> | Trying to read them as unary multiplication and exponentiation doesn't really help either. |
00:49 | <@ToxicFrog> | Although, in fairness, I can't come up with a good replacement |
00:49 | <@Finerty> | ` and @ and $ are available. |
00:50 | <@ToxicFrog> | @ and @@, perhaps. |
00:50 | <@Finerty> | well, not so much @, that's used for decorators, which really do feel kinda tacked on in my view |
00:50 | <@ToxicFrog> | Aah. |
00:50 | <@Finerty> | JeffPL: describe this weird trouble |
00:50 | < JeffPL> | @traced is something I wrote myself for homework. |
00:50 | <@ToxicFrog> | What're decorators? |
00:50 | < JeffPL> | Only there appears to be a bizarre implementation detail- |
00:50 | < JeffPL> | Okay. |
00:51 | <@Finerty> | TF: decorators are, uh, what they do is they call functions on methods after they're defined, to change them |
00:51 | < JeffPL> | I don't know if @traced is a reimplementation of something that exists already. Should I explain it? |
00:51 | <@Finerty> | Explain away. |
00:51 | <@ToxicFrog> | Aah. Makes sense. |
00:51 | <@Finerty> | Common usage makes them used to turn methods into class methods |
00:51 | < JeffPL> | Traced is something apparently that we wrote to track recursive function calls- do you mind if I copy and paste into chan the text of an example we were given? |
00:52 | <@Finerty> | show me |
00:52 | <@ToxicFrog> | If it's long, use the pastebin |
00:53 | <@Finerty> | And yes, use the pastebin |
00:59 | < JeffPL> | That's how it's supposed to work... but there's apparently supposed to be one thing like that for *all* functions that are called. |
00:59 | <@Finerty> | um |
00:59 | < JeffPL> | IE, if my function that's being @traced calls another @traced function. |
01:00 | < JeffPL> | Yes? |
01:00 | | mode/#code [+ooooo Attilla C_tiger EvilDarkLord GeekSoldier|bed JeffPL] by Finerty |
01:00 | | mode/#code [+ooo Kazriko Pi-2 Raif] by Finerty |
01:00 | <@Finerty> | Paste again? |
01:00 | <@JeffPL> | ...ah. DidI need an op to post the link? |
01:00 | | mode/#code [+o Moltare] by Finerty |
01:00 | <@Finerty> | Yes |
01:00 | <@JeffPL> | http://rafb.net/p/2FbQaY69.html |
01:01 | <@JeffPL> | IE, if a @traced function calls another @traced function, there's not two seperate levels for their recursion, only one global one. |
01:01 | <@JeffPL> | And I have no idea how to do a global decorator like that. |
01:01 | <@JeffPL> | A singleton. |
01:02 | <@Finerty> | it probably uses a global variable |
01:02 | <@Finerty> | Or something. I'm not entirely sure |
01:05 | <@ToxicFrog> | Pastebin the code for @traced itself? |
01:05 | <@ToxicFrog> | Probably what you want is local variables for function state (arguments and return value), and a global variable for nesting level |
01:05 | <@ToxicFrog> | (well, global across all @traceds - an upvalue?) |
01:06 | <@JeffPL> | (That's the problem, if I could create a global across all @traceds , I wouldn't be in this mess) |
01:06 | <@JeffPL> | (Or at least I don't know how to) |
01:06 | <@Finerty> | use the global keyword |
01:06 | <@ToxicFrog> | My first wild stab at that would be something like: |
01:06 | <@ToxicFrog> | level = 0 |
01:07 | <@ToxicFrog> | def @traced: ... |
01:07 | <@ToxicFrog> | Aah. |
01:07 | <@ToxicFrog> | Or that. |
01:07 | <@JeffPL> | So wait, it's as easy as changing self.__timescalled = 0 to global self.__timescalled = 0 ? |
01:07 | <@Finerty> | no |
01:07 | <@Finerty> | __timescaled = 0; |
01:07 | <@JeffPL> | ..no I probably need to kill that self. |
01:08 | <@Finerty> | def @traced(...) |
01:08 | <@Finerty> | global __timescaled |
01:08 | <@Finerty> | ... |
01:08 | <@JeffPL> | ah. |
01:08 | <@Finerty> | well, sort of. I've never written a decorator. |
01:13 | <@JeffPL> | Well, how do global variables normally work? |
01:13 | <@JeffPL> | Inside a class? |
01:14 | <@ToxicFrog> | If they work like globals in other languages, they're scoped to either the entire file that contains them, or the entire program, regardless of what class or function you are accessing them from |
01:15 | <@Finerty> | Technically what it says is, "instead of creating a new variable when assigning to something not in local scope, assign to the existing one you can see" |
01:15 | <@Finerty> | A global variable in this case would probably be outside the class but inside the module. |
01:16 | <@Finerty> | But |
01:16 | <@JeffPL> | But? |
01:16 | <@Finerty> | That's fancy fancy details. |
01:17 | <@Finerty> | Just put it outside the class, and you'll have it. |
01:17 | <@JeffPL> | What if we aren't allowed to put anything outside the class? |
01:17 | <@Finerty> | Then, hell, I don't know |
01:17 | <@Finerty> | I don't know enough about decorators to really be able to answer your question. |
01:18 | <@JeffPL> | This isn't really a question about decorators anymore. It's about classes. How much do you know about python classes? |
01:23 | <@JeffPL> | A decorator is just a class with some stuff added to it. |
01:24 | <@JeffPL> | Right now, what I need to know is, in Python, how do you create a class with a global variable, initalized at zero, that increments any time a specific function is called from any instance of the class? |
01:27 | <@JeffPL> | Or do you not know how to do that? |
01:31 | <@Finerty> | well, a class with a variable, you just use a class variable |
01:31 | <@Finerty> | I didn't realize decorators were classes. |
01:31 | <@JeffPL> | Yes, they are. |
01:31 | <@JeffPL> | So how do I declare a global class variable? |
01:32 | <@Finerty> | If decorators are classes, then you don't need to, you just create a class variable, and have the decorator's pre-call function talk to that. |
01:33 | <@ToxicFrog> | Finerty: I think the issue is that each decorated function gets a new instance |
01:33 | <@ToxicFrog> | And we need a shared variable |
01:33 | <@JeffPL> | Yes, exactly. |
01:33 | <@Finerty> | Right |
01:34 | <@Finerty> | Then you use a class-wide variable, which... I don't actually remember how to create |
01:34 | <@JeffPL> | Is there anywhere I can look that up? |
01:34 | <@Finerty> | It'll be in the official tutorial, I think |
01:34 | <@Finerty> | That or the language reference, which is kinda oblique. |
01:38 | | JeffPL [80364597@Nightstar-9250.mibbit.com] has quit [Quit: http://www.mibbit.com ajax IRC Client] |
01:40 | | JeffPL [80364597@Nightstar-9250.mibbit.com] has joined #code |
01:40 | < JeffPL> | Ow. |
01:40 | < JeffPL> | Disconnected. |
01:41 | < JeffPL> | Hey, Vorn, if you said anything after my last line, I missed it. |
01:41 | < JeffPL> | Or Finerty. |
01:41 | < JeffPL> | Whatever you want to be called now |
01:42 | | Finerty [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout] |
01:42 | < JeffPL> | ... lovely |
01:46 | | Finerty [~vorn@76.233.7.ns-4583] has joined #code |
01:46 | | mode/#code [+o Finerty] by ChanServ |
01:47 | < JeffPL> | I disconnected shortly before you did. |
01:47 | < JeffPL> | Don't know if you saw that. |
01:48 | <@Finerty> | I saw you disconnect, yes. |
01:48 | < JeffPL> | I missed everything you said after the last thing I said before disconnecting. |
01:49 | < JeffPL> | If you said anything at all. |
01:49 | <@Finerty> | [Mon 21:35:34] JeffPL Is there anywhere I can look that up? |
01:49 | <@Finerty> | [Mon 21:36:01] Finerty It'll be in the official tutorial, I think |
01:49 | <@Finerty> | [Mon 21:36:10] Finerty That or the language reference, which is kinda oblique. |
01:49 | < JeffPL> | Where are those two iitems? |
01:50 | <@Finerty> | http://www.python.org/doc/ |
01:50 | | JeffPL [80364597@Nightstar-9250.mibbit.com] has quit [Quit: http://www.mibbit.com ajax IRC Client] |
01:51 | <@Finerty> | ...heh |
01:53 | <@ToxicFrog> | Relayed. |
02:56 | | Finerty is now known as Vornicus |
03:53 | | Pi-2 is now known as Pi |
04:27 | | Vornicus is now known as Vornicus-Latens |
05:47 | | GeekSoldier|bed is now known as GeekSoldier|work |
05:58 | | Serah [~Z@87.72.35.ns-26506] has joined #Code |
05:58 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has joined #code |
05:58 | | mode/#code [+o Thaqui] by ChanServ |
06:19 | | Kazriko [~kaz@72.174.26.ns-12779] has quit [Client exited] |
06:38 | | Vornicus-Latens [~vorn@76.233.7.ns-4583] has quit [Ping Timeout] |
06:39 | | AnnoDomini [AnnoDomini@83.21.41.ns-3845] has joined #Code |
06:39 | | mode/#code [+o AnnoDomini] by ChanServ |
06:45 | | Vornicus-Latens [~vorn@76.233.7.ns-4583] has joined #code |
06:45 | | Kazriko [~kaz@Nightstar-26352.gdj-co.client.bresnan.net] has joined #code |
07:05 | | You're now known as TheWatcher |
07:12 | | Raif [~corvusign@67.161.90.ns-4200] has quit [Killed (NickServ (GHOST command used by Raif_))] |
07:12 | | Raif_ [~corvusign@67.161.90.ns-4200] has joined #Code |
07:12 | | Raif_ is now known as Raif |
07:55 | | GeekSoldier|work [~Rob@Nightstar-8928.dip.t-dialin.net] has quit [Ping Timeout] |
08:15 | | You're now known as TheWatcher[afk] |
09:20 | <@Reiver> | ...Is it wrong to be parsing the commandline instructions for my java program outside of a constructor? |
09:54 | | Raif [~corvusign@67.161.90.ns-4200] has quit [Ping Timeout] |
09:58 | | Raif [~corvusign@67.161.90.ns-4200] has joined #Code |
10:03 | | You're now known as TheWatcher |
10:06 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has left #code [Leaving] |
10:21 | <@TheWatcher> | Reiver: Uh, I'd never, ever do any Real Work inside a constructor anyway |
10:22 | <@TheWatcher> | But then, that's partly due to using c++ in game code so much |
10:23 | <@TheWatcher> | (where you don't want anything in constructors that could fail, and you want them to complete as quickly as possible, moving actual setup work out into a separate function that can be called when needed, and include sane checks - this is somewhat less of an issue in normal java code >.>) |
10:24 | <@Reiver> | right |
11:03 | | * Moltare moves on to the more-or-less final hurdle |
11:04 | <@Moltare> | I have a lexer that reads stuff and makes tokens out of it. I have a parser that breaks a stream of tokens into goals, expressions, factors and whatnot. |
11:04 | <@Moltare> | Now I need to have it print that broken-down string in some same and readable fashion |
11:05 | <@Moltare> | er, s/string/stream |
11:07 | <@Reiver> | You mean readable to a human? |
11:07 | <@Moltare> | yep |
11:07 | <@Moltare> | It doesn't need to actually make the program Do its Thang, merely print out (say) a tree of the components recognised |
11:08 | <@Moltare> | Apparently this involves push and pop. |
11:21 | <@EvilDarkLord> | That sounds like it requires a stack. |
11:22 | <@Moltare> | Indeed |
11:23 | | * Moltare is reading about same |
11:23 | <@EvilDarkLord> | Oh, wait. Was this a calculator? |
11:29 | <@Moltare> | Compiler |
11:29 | <@Moltare> | Or, at least, the lexer and parser parts |
11:30 | | AnnoDomini [AnnoDomini@83.21.41.ns-3845] has quit [Ping Timeout] |
11:37 | | AnnoDomini [AnnoDomini@83.21.31.ns-26029] has joined #Code |
11:37 | | mode/#code [+o AnnoDomini] by ChanServ |
11:37 | <@Moltare> | hrm. Is there a way to make Dev-C++ log its output? at the moment the input/output window is disappearing with all my test printfs |
11:39 | <@Moltare> | also I seem to have forgotten to tell the paser what "=" means. doh. |
11:40 | <@Moltare> | *parser |
11:41 | <@TheWatcher> | Moltare: you mean the output window is closing at the end of main()? If so, one method is to stick system("PAUSE") at the end of main(). |
11:41 | <@Moltare> | (I got round it by running the program under cmd, but thank you) |
11:43 | <@Moltare> | And, by the looks of that output, it works |
11:43 | <@TheWatcher> | Woot! |
11:48 | <@Moltare> | (apart from =, which I've forgotten to put in, and scientific notation, and floating-point numbers) |
11:49 | <@Moltare> | oh, also, I need to strip the first and last characters off of a string. Is there a convenient thing that does this? |
11:49 | <@TheWatcher> | Last, yes. First, no. |
11:50 | <@Moltare> | What about to remove a specific character? |
11:50 | <@Moltare> | My strings come in as ""string"", and they need to be stored as "string", see |
11:50 | <@TheWatcher> | Last you can do with string[strlen(string) - 1] = '\0'; |
11:51 | <@TheWatcher> | Are your strings in arrays or malloc()ed memory? |
11:51 | <@Moltare> | um |
11:52 | <@TheWatcher> | *snurg* well, what you can do is |
11:53 | <@Moltare> | char* |
11:53 | <@TheWatcher> | *shrug |
11:54 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
11:54 | | mode/#code [+o gnolam] by ChanServ |
11:54 | <@TheWatcher> | while(*string) { *string = *(string + 1); ++string; } |
11:54 | <@TheWatcher> | that'll move everything down one in the string, effectively removing the first character |
11:55 | <@TheWatcher> | so I'd suggest writing a trim(char *string) function that removes the last char, then removes the first. |
11:57 | <@Moltare> | Sounds like a plan to me :) |
12:05 | <@Moltare> | ack |
12:05 | <@Moltare> | that removed the whole string |
12:07 | <@TheWatcher> | Huh. |
12:12 | <@TheWatcher> | http://rafb.net/p/bHGEXC18.html - mol? |
12:12 | <@TheWatcher> | that should just print out |
12:12 | <@TheWatcher> | Result: this is a test |
12:14 | <@Moltare> | oops |
12:14 | <@Moltare> | had it return as char* |
12:14 | <@TheWatcher> | Heh. yeah - at the end, string is pointing at the \0 at the end of the string |
12:15 | <@Moltare> | "Void value not ignored as it ought to be"? |
12:15 | <@Moltare> | oh wate |
12:16 | <@Moltare> | fxd |
12:20 | <@Moltare> | aw/right/ |
12:53 | | You're now known as TheWatcher[d00m] |
12:59 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
13:05 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
13:05 | | mode/#code [+o gnolam] by ChanServ |
14:02 | | You're now known as TheWatcher |
15:27 | | * Moltare is confused |
15:28 | <@Moltare> | When one types in, say, 2.3e3, it's supposed to recognise that as a T_SCI and get its value from atof(yytext) |
15:28 | <@Moltare> | Instead it recognises it as a T_SCI and gets its value from 8899234823950000000000000000000000000000000000000000000.00000 or similar |
15:28 | <@Moltare> | Same with T_FLOAT |
15:29 | <@Moltare> | Since they share atof(yytext)s, I think I'm somehow Doing That Wrong |
15:31 | <@ToxicFrog> | That seems likely, yes |
15:31 | | * ToxicFrog tests something |
15:33 | <@ToxicFrog> | Wow. This is messed up. |
15:34 | <@ToxicFrog> | I'm trying it myself: printf("%f\n", atof("2.3e3")) |
15:34 | <@ToxicFrog> | It gets a different answer each time. |
15:37 | <@ToxicFrog> | Hmm. |
15:37 | | You're now known as TheWatcher[afk] |
15:37 | <@ToxicFrog> | Now it's returning 0 but saying no error occured. |
15:38 | <@ToxicFrog> | If I use atoi, it works |
15:38 | <@ToxicFrog> | Well, it works for integers |
15:50 | <@ToxicFrog> | Ok, I can't get atof working either |
15:54 | <@ToxicFrog> | Interestingly, if it's: |
15:55 | <@ToxicFrog> | printf("%f\n", atof(...)) |
15:55 | <@ToxicFrog> | I get random results, but if it's: |
15:55 | <@ToxicFrog> | double f = atof(...); printf("%f\n", f); |
15:55 | <@ToxicFrog> | I get 0.0. |
15:56 | <@Moltare> | how bizarre |
15:59 | <@ToxicFrog> | Very. |
16:30 | | GeekSoldier|work [~Rob@Nightstar-9987.dip.t-dialin.net] has joined #code |
16:31 | <@gnolam> | What about strtod? |
16:34 | <@ToxicFrog> | Same thing. |
16:34 | <@ToxicFrog> | Returns 0, does not set errno. |
16:37 | | GeekSoldier|work is now known as GeekSoldier |
16:55 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
16:56 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
16:56 | | mode/#code [+o gnolam] by ChanServ |
17:05 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
17:05 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
17:05 | | mode/#code [+o gnolam] by ChanServ |
17:13 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
17:15 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
17:15 | | mode/#code [+o gnolam] by ChanServ |
17:31 | | Vornicus-Latens is now known as Vornicus |
17:36 | <@Moltare> | So, having confirmed that that's Doing it Wrong, any advice on how to Do it Right? |
17:37 | <@Moltare> | I'm lost at C here ¬¬ |
17:42 | | C_tiger [~c_wyz@Nightstar-16221.nycmny.east.verizon.net] has quit [Quit: restart] |
17:44 | | Xiphias [~Ameroth@81.141.243.ns-22211] has joined #code |
17:56 | | C_tiger [~c_wyz@Nightstar-16221.nycmny.east.verizon.net] has joined #code |
17:56 | | Xiphias [~Ameroth@81.141.243.ns-22211] has quit [Quit: I was never gone] |
18:12 | | You're now known as TheWatcher |
19:00 | <@gnolam> | Boo. |
19:01 | <@gnolam> | But what's doing what wrong? |
19:01 | <@gnolam> | (Someone's been feeding crack to the primates who work for my ISP again, so my backscroll is... unreliable) |
19:19 | <@ToxicFrog> | Moltare: as far as I can tell, you're doing it right |
19:19 | <@ToxicFrog> | It just doesn't work |
19:20 | <@Moltare> | In which case, what I'm Doing Wrong is using it~ and given that I've less than a day to get the thing finished, I may just have to include a line or two in the bumf explaining such :P |
19:21 | <@Moltare> | Unless there's a different way, but I don't know it if there is |
19:24 | <@ToxicFrog> | There's writing your own. |
19:45 | | GeekSoldier is now known as GeekSoldier|bed |
21:55 | <@McMartin> | How's strtod() working? |
21:55 | | * McMartin missed backscroll, so. |
21:55 | <@ToxicFrog> | It's not. |
21:55 | <@ToxicFrog> | Returns 0, does not set errno. |
21:57 | <@ToxicFrog> | ...oh, hang on |
21:57 | <@ToxicFrog> | Moltare: are you including <stdlib.h>? |
21:57 | <@Moltare> | and math.h |
21:57 | <@ToxicFrog> | Hmm. Ok, it's not that then. |
21:58 | <@McMartin> | What happens if you add -lm to the linker options? |
21:58 | <@ToxicFrog> | I found that without including stdlib.h, it implicitly declares it as returning int |
21:58 | <@ToxicFrog> | Which means it works, but returns seemingly random and incorrect values |
21:58 | <@ToxicFrog> | And gcc won't warn you about this without -Wall or -std=c99 |
21:58 | <@ToxicFrog> | So double check that. |
22:00 | <@ToxicFrog> | McMartin: tried that, it doesn't work. |
22:00 | <@ToxicFrog> | Anyways. |
22:00 | <@ToxicFrog> | I found out that the problem at my end was forgetting to #include <stdlib.h>, and not compiling with -Wall |
22:01 | <@Moltare> | I've got that in, but it still gives Silly responses |
22:02 | <@McMartin> | wate |
22:02 | | * McMartin checks something |
22:04 | <@McMartin> | Try making your printf %lf instead of %f. |
22:04 | <@ToxicFrog> | %f is double, according to the man page |
22:04 | <@McMartin> | Lies and more lies. |
22:05 | <@Moltare> | nyet, still bork |
22:05 | <@McMartin> | Though it works with either on this end. |
22:06 | <@McMartin> | I decidedly did *not* on the old lab machines, which insisted that %f be float. |
22:07 | <@McMartin> | Anyway. Assuming I include stdlib.h and stdio.h, "printf ("%f\n", atof(argv[1]));" works on this system. |
22:08 | <@ToxicFrog> | Likewise. |
22:09 | <@ToxicFrog> | Mol, are you quite sure you're including those headers in everything you have that uses atof, that you've properly recompiled with them in, and that no compile warnings are emitted? |
22:09 | <@McMartin> | As does %lf. |
22:09 | <@Moltare> | Yes. |
22:10 | <@ToxicFrog> | Including regenerating your lex.yy.c from the .l input file? |
22:11 | <@Moltare> | Well, since the section that's trying to atof(yytext) is in lex.yy.c, and lex.yy.c is made from the .l file, I didn't know there's a way not to |
22:12 | <@Moltare> | Change lexer.l -> flex it to make lex.yy.c -> remove lex.yy.c from project -> add new lex.yy.c to project -> compile -> execute, or? |
22:12 | <@ToxicFrog> | That's what I meant. |
22:12 | <@ToxicFrog> | I was making sure you didn't just hit "recompile", which is an easy mistake to make. |
22:14 | <@Moltare> | I've already done my share of that for one project, I hope ¬¬ |
22:14 | <@ToxicFrog> | Are you sure the build system is actually recompiling lex.yy.c rather than reusing a cached object file? |
22:15 | <@Moltare> | Well, I think so. I tried breaking something in it and recompiling to see if it noticed, and it did, so |
22:15 | <@Moltare> | -, |
22:15 | <@ToxicFrog> | Hmm |
22:15 | <@ToxicFrog> | In that case I've got nothing |
22:16 | <@ToxicFrog> | Does the simple one-liner McM mentioned work at all? |
22:17 | <@ToxicFrog> | http://pastebin.org/23318 that is |
22:17 | <@ToxicFrog> | It should produce a program you run as, say, "test.exe 123.456" and it outputs "123.456" |
22:18 | <@Moltare> | Yes, that works fine |
22:30 | <@ToxicFrog> | Then there must still be something wrong with your usage of it in the lexer. All I can think of is the missing includes, using "float" type variables (the return type is of type "double", despite the name, and those are what you should be using) or other type mismatches.. |
22:30 | <@ToxicFrog> | Anyways, I have to run now...back in 3-4 hours. |
22:31 | <@Moltare> | ...ah |
22:31 | <@Moltare> | Thank you! |
22:31 | <@Moltare> | I'd declared it as float, not double |
22:32 | <@Moltare> | And now it works |
22:45 | | * Moltare is happy now, for his lexerparserthing is viable! |
22:45 | <@Moltare> | if not robust at all, but meh. |
22:45 | <@McMartin> | Of course it's not robust. It's written in C. |
22:46 | <@Moltare> | Not, it's not robust because you can give it 2 = ( 1 = 3 ); and it won't complain at you. |
23:10 | | AnnoDomini [AnnoDomini@83.21.31.ns-26029] has quit [Quit: Some people have evil spirits. You, you have stupid spirits. Go see shaman. Get hole in head. Big hole. Very big. Huge!] |
23:19 | < C_tiger> | Moltare, does it check for valid variable names? |
23:19 | < C_tiger> | that should pick up on at least SOME assignment-to-constant errors. |
23:19 | <@Moltare> | Well, they have to be alphanumeric and begin with a-z or _ |
23:20 | < C_tiger> | Then you just have to check that the thing before a = is a valid variable. |
23:20 | < C_tiger> | (remembering that foo[bar] is a valid variable as is foo[4] etc. |
23:21 | <@Moltare> | (not in this it ain't) |
23:21 | < C_tiger> | Well, it's a valid place to store stuff. |
23:21 | <@Moltare> | (this is the dodgy language our lecturer came up with and it doesn't do arrays) |
23:21 | < C_tiger> | Ok... um, then you just have to check for a valid variable in front of the assignment operator. |
--- Log closed Wed Mar 12 00:00:34 2008 |