--- Log opened Sun Apr 27 00:00:04 2008 |
00:01 | < Jeff> | Hey, Shoukan- interested in working as a tester on a project? |
00:01 | < Shoukanjuu> | Excuse me wot |
00:01 | < Shoukanjuu> | I'm actually going to start cutting plastic to make an Ikaruga model |
00:02 | < Shoukanjuu> | But, sure, what do you need me to do |
--- Log opened Sun Apr 27 00:20:36 2008 |
00:20 | | TheWatcher [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
00:20 | | Irssi: #code: Total of 22 nicks [12 ops, 0 halfops, 1 voices, 9 normal] |
00:20 | | mode/#code [+o TheWatcher] by ChanServ |
00:21 | | Irssi: Join to #code was synced in 54 secs |
00:26 | < Jeff> | Eh, go cut plastic |
00:26 | < Shoukanjuu> | I need more o.o; |
00:27 | | You're now known as TheWatcher[T-2] |
00:30 | | You're now known as TheWatcher[zZzZ] |
00:36 | | Jeff [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has quit [Quit: Leaving] |
00:45 | <@AnnoDomini> | Seriously, what the fuck? How does this interrupt service work? It most certainly does not give me proper values. |
00:54 | <@ToxicFrog> | If I had to guess, I'd guess it gives you the mouse position as if the screen was at 640x200 resolution. |
00:54 | <@ToxicFrog> | Eg, if the mouse is 3/4 of the way down the screen and 1/2 the way across, it will return (320,150) regardless of video mode. |
00:54 | <@ToxicFrog> | But this is just a guess. |
00:54 | <@ToxicFrog> | Why are you doing dos interrupt programming again? |
00:55 | <@AnnoDomini> | Because I want to pass this semester. |
00:55 | <@ToxicFrog> | Aah. |
00:59 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
01:02 | <@AnnoDomini> | There are white vertical lines appearing for no good reason. The coordinates of the points for beginning and end which should match don't match. I don't bloody know what's wrong. |
01:18 | <@AnnoDomini> | It's completely out of whack. Even simple putting the damned pixels there with PutPixel won't work. It really can't be a problem with the Bresenham Algorithm, that thing was thoroughly tested earlier. |
01:45 | | JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has joined #code |
01:49 | | Shoukanjuu [~Shoukanju@Nightstar-18016.dhcp.embarqhsd.net] has quit [Connection reset by peer] |
01:51 | | Shoukanjuu [~Shoukanju@Nightstar-18016.dhcp.embarqhsd.net] has joined #code |
02:09 | | AnnoDomini [AnnoDomini@Nightstar-6902.neoplus.adsl.tpnet.pl] has quit [Quit: Drive me closer, I want to hit them with my sword!] |
05:38 | | Chalcy [~Chalcy@Nightstar-488.ue.woosh.co.nz] has joined #code |
05:39 | | Chalcedon [~Chalcy@Nightstar-488.ue.woosh.co.nz] has quit [Ping Timeout] |
06:07 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
06:07 | | mode/#code [+o gnolam] by ChanServ |
06:46 | | gnolam is now known as gnola|m| |
07:06 | | Vornicus is now known as Vornicus-Latens |
07:15 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has joined #code |
07:15 | | mode/#code [+o Thaqui] by ChanServ |
07:18 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
07:18 | | mode/#code [+o gnolam] by ChanServ |
07:19 | | gnola|m| [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
09:12 | | Chalcy [~Chalcy@Nightstar-488.ue.woosh.co.nz] has quit [Quit: Leaving] |
09:31 | | AnnoDomini [AnnoDomini@Nightstar-6902.neoplus.adsl.tpnet.pl] has joined #Code |
09:31 | | mode/#code [+o AnnoDomini] by ChanServ |
09:50 | | You're now known as TheWatcher |
10:04 | <+Molgorn> | Why is "extern yylval TREE*;" broken? |
10:04 | <+Molgorn> | It even says that sort of thing should work, in the guides I've found |
10:10 | | AnnoDomini [AnnoDomini@Nightstar-6902.neoplus.adsl.tpnet.pl] has quit [Ping Timeout] |
10:16 | <+Molgorn> | It's also claiming at two points that I've not defined checkType and setType. One of those points is the place I define them. ¬¬ |
10:17 | | AnnoDomini [AnnoDomini@Nightstar-29716.neoplus.adsl.tpnet.pl] has joined #Code |
10:17 | | mode/#code [+o AnnoDomini] by ChanServ |
10:20 | | Brother_Willibald [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
10:21 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
10:54 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
10:54 | | mode/#code [+o gnolam] by ChanServ |
10:54 | | Brother_Willibald [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
11:03 | | Brother_Willibald [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
11:03 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
11:49 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
11:49 | | mode/#code [+o gnolam] by ChanServ |
11:50 | | Brother_Willibald [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
11:58 | | Brother_Willibald [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
11:58 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
12:00 | <+Molgorn> | If I may: http://rafb.net/p/vOKqdT31.html <- it tells me that 59 is a syntax error, which then causes all the yylval-> to break in lexer.l |
12:00 | <+Molgorn> | Also it claims I've not defined checkType or setType, and this is a lie |
12:00 | <+Molgorn> | Anyone able to help? I'm totally lost |
12:07 | | * jerith looks |
12:10 | <@jerith> | Your typedef there is wrong. |
12:11 | <@jerith> | You need to either "struct TREE { ... };" or "typedef struct { ... } TREE;" |
--- Log closed Sun Apr 27 12:29:11 2008 |
--- Log opened Sun Apr 27 12:29:16 2008 |
12:29 | | TheWatcher [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
12:29 | | Irssi: #code: Total of 22 nicks [13 ops, 0 halfops, 0 voices, 9 normal] |
12:29 | | mode/#code [+o TheWatcher] by ChanServ |
12:30 | | Irssi: Join to #code was synced in 51 secs |
12:31 | <@Moltare> | http://rafb.net/p/23yzZk27.html |
12:32 | <@Moltare> | Thanks for looking at this, by the bye; I'm totally out of ideas |
12:38 | <@jerith> | struct TREE *left; <-- If you've typedefed it, you just use "TREE", not "struct TREE". |
12:39 | <@Moltare> | I thought that originally |
12:40 | <@Moltare> | But if I take the "struct" away, I get "syntax error before *" |
12:45 | <@jerith> | Hmm. |
12:45 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has left #code [Leaving] |
13:06 | <@Moltare> | (also that chunk of code I gacked off the lecturer, so I'm fairly sure it's right) |
13:19 | <@Moltare> | bah, all I'm doing is staring at the code |
13:19 | <@Moltare> | I'll come back to it in a bit and see if I can make more progress |
15:05 | <@Moltare> | BLAH |
15:06 | <@Moltare> | seems the answer is no. |
15:06 | <@Moltare> | On the verge of saying "sod it, this is how it should work and what it'd do if it did" and hoping for the 40% I need on this coursework. |
15:07 | <@Moltare> | + "and how I would test it and what I'd expect the results to be", but you know the drill |
15:07 | <@McMartin> | yylval is a TREE |
15:07 | <@McMartin> | You're treating it as if it were a TREE * |
15:07 | <@McMartin> | yylval.type = etc |
15:08 | <@McMartin> | Or at least lexel.l thinks it is. |
15:08 | <@McMartin> | Oh, wait |
15:08 | <@McMartin> | While we're at it |
15:08 | <@Moltare> | If I do that it tells me yylval is an int |
15:08 | <@Moltare> | Despite having specifically told it it's not |
15:08 | <@McMartin> | It's including something else. |
15:08 | <@McMartin> | I'm more concerned with the "typedef struct TREE TREE" thing |
15:09 | <@McMartin> | Make the struct be named tree_struct and then typedef that to TREE |
15:10 | <@McMartin> | What does y.tab.h have to say about yylval? |
15:10 | <@Moltare> | Nothing at all |
15:10 | <@Moltare> | And how does this look: |
15:10 | <@Moltare> | struct tree_struct { |
15:10 | <@Moltare> | struct tree_struct *left; |
15:10 | <@Moltare> | struct tree_struct *right; |
15:10 | <@Moltare> | int value; |
15:10 | <@Moltare> | int type; |
15:10 | <@Moltare> | char *string; |
15:10 | <@Moltare> | }; |
15:10 | <@Moltare> | typedef tree_struct TREE; |
15:10 | <@Moltare> | ? |
15:11 | <@McMartin> | That looks like better form to me. |
15:11 | <@McMartin> | Even if that's not the problem, it's definitely best practice. |
15:11 | <@Moltare> | So noted |
15:12 | <@McMartin> | You are calling flex with -d, right? |
15:12 | <@Moltare> | No, I'm calling bison with -d |
15:12 | <@Moltare> | Should I do that with flex too? |
15:13 | <@McMartin> | Hrm, nm |
15:13 | <@McMartin> | I read that bit of the manual wrong |
15:14 | <@Moltare> | Well, changing the above has got it back to 11 errors again, of which about half are duplicates of others |
15:15 | <@McMartin> | Hm. |
15:15 | <@McMartin> | Suppose you do the extern definition of yylval in the Lexer header too? |
15:16 | <@McMartin> | That stuff that's in your parser header the lexer is entirely ignorant of. |
15:16 | <@McMartin> | So that's a problem |
15:16 | <@McMartin> | You also don't seem to ever actually be allocating any values to stick into yylval, which is more than a bit alarming |
15:17 | <@Moltare> | Well, in theory... yyin takes input from wherever and sends it to yylex, which causes flex to stick the results of all its flexing into yylval, which then gets yyparsed by the parser |
15:18 | <@Moltare> | unless I'm reading something wrong, all that is dealt with |
15:19 | <@Moltare> | yyin is redefined in main, the middle section of lexer.l sort out where yylex sends everything, and yyparse handles yylex and is called in main. |
15:19 | <@McMartin> | Where does makenode ever get called? |
15:19 | <@Moltare> | It doesn't |
15:19 | <@McMartin> | Yeah, so, that's firey doom right there |
15:19 | <@Moltare> | As far as I know it's something to do with drawing the tree? when I get round to that? |
15:20 | <@Moltare> | the one this whole mess is supposed to output |
15:20 | <@McMartin> | Look at your actions |
15:20 | <@McMartin> | You're assigning to the value of yylval |
15:20 | <@McMartin> | yylval itself is never created |
15:20 | <@Moltare> | surely either flex or bison deals with that? |
15:20 | <@McMartin> | This is a run-time error, but you're just going to scribbling repeatedly over a random chunk of memory somewhere instead of actualy having separate tree values for each element. |
15:20 | <@McMartin> | No. |
15:20 | <@Moltare> | ugh. |
15:21 | <@McMartin> | yylval is a 32-bit integer that indicates where in memory the structure is supposed to be. |
15:21 | <@McMartin> | It is originally whatever happens to be there. |
15:21 | <@McMartin> | A proper value for it is returned by makenode. |
15:21 | <@McMartin> | But that won't break compilation. |
15:21 | | * Moltare facepalms. |
15:22 | <@McMartin> | (And this, incidentally, is why I scoff at your professor claiming that C is the only sane language to do this in) |
15:22 | <@McMartin> | (It is quite possibly the *last* sane such language) |
15:22 | <@Moltare> | Definitely tempted to return a report of "if you want me to write compilers in C, please consider including a C module in the course somewhere" |
15:23 | <@McMartin> | Easy enough to fix, though |
15:23 | <@McMartin> | See in the .l where you're assigning to llyval.type? |
15:23 | <@Moltare> | aye |
15:23 | <@McMartin> | Er, ->value, rather. |
15:23 | <@McMartin> | Keep the type assigns. |
15:23 | <@McMartin> | Move the value assigns first and make it "yylval = makenode ({the value}, NULL, NULL);" |
15:24 | <@McMartin> | And then you'll be creating the new values. The parser itself is fine. |
15:24 | <@Moltare> | ahh |
15:25 | <@McMartin> | I'm also wondering if that extern TREE *yylval; line should be in the lexer.l prologue, not the parser.y one. |
15:25 | <@McMartin> | After all, you're getting a duplicate declaration complaint. |
15:27 | <@McMartin> | Anyway, I must pause for breakfast and such. |
15:28 | <@Moltare> | And I must see how many other things I'm about to break by hilariously misinterpreting some incredibly basic tenet of C |
15:31 | <@Moltare> | eh, only 17 errors |
15:31 | <@Moltare> | I'm almost disappointed. |
15:32 | <@Moltare> | oh, no, 12 the second time I compile the same code |
15:33 | <@Moltare> | woo, 6 this time |
15:33 | <@Moltare> | ...back up to 8 |
15:33 | <@Moltare> | ...stable at 6 |
15:36 | <@Moltare> | of course, one of them is "syntax error before *" in line 7, which in my limited experience means "By god we've got an imminent can of worms here boyo" |
15:54 | | * Moltare pastes up his current version, for form's sake |
15:54 | <@Moltare> | http://rafb.net/p/fYfjbw83.html |
16:29 | <@McMartin> | Yikes |
16:29 | <@McMartin> | First things first |
16:29 | <@McMartin> | makenode needs to return n |
16:30 | <@McMartin> | Second, the definition of TREE is in y.y |
16:30 | <@McMartin> | Unlike in Java, every single source file in C has to be totally self-contained, and replicate all the information it uses. |
16:31 | <@McMartin> | Traditionally you put things multiple files use (like the function prototypes for makenode, the definition of TREE, etc.) into a .h file and have everybody #include it. |
16:31 | <@Moltare> | again, I thought that the malarkey with flex and bison handled that |
16:31 | <@Moltare> | the whole y.tab.h thing |
16:31 | <@McMartin> | No. y.tab.h is only stuff you're not writing. |
16:32 | <@McMartin> | That bit where you're putting in #include <stdio.h> and all that at the top of y.y is only for the file bixon produces. |
16:32 | <@McMartin> | So yy.lex.c is blissfully (well, OK, viciously) ignorant of it |
16:32 | <@McMartin> | Incidentally, your reaction to this also confirms a suspicion I have long had. |
16:33 | <@Moltare> | "Trying to write C partly with two different tools that partly interact is a bad idea when you don't know the language"? |
16:33 | <@McMartin> | Lots of people going from C to Java ranted, raged, and raved about how Java insisted that your directory structure match package structure, you can only have one public class per file, etc. |
16:34 | <@McMartin> | My suspicion was that going the other direction would produce "WHY IS THIS COMPILER SO FUCKING STUPID", and it clearly does. |
16:36 | <@McMartin> | So the first problem is yy.lex.c not knowing about TREE. |
16:36 | <@Moltare> | So... I need to take out everything from 43-52 in y.y and 5 in lexer.l and stick it in some .h file which I then include? |
16:36 | <@McMartin> | At the beginning of both the .l and .y, yes. |
16:36 | <@McMartin> | That leaves the problem regarding "string". |
16:37 | <@McMartin> | Also, the reason that you're getting ever smaller numbers of reports on repeated recompilation is because files with warnings but no errors actually successfully compile. |
16:37 | <@McMartin> | There's only two actual errors here. |
16:37 | <@McMartin> | Well, three |
16:37 | <@McMartin> | For whatever reason, the .y file doesn't know what yyin is, either. |
16:38 | <@McMartin> | "implicit declaration of..." isn't actually an error, it just means that some .h file or other function prototype is missing. |
16:38 | <@Moltare> | Well, plus all the runtime errors and unexpected behaviour that'll show up when I try to run stuff |
16:38 | <@McMartin> | It will bitch, but move on. |
16:38 | <@McMartin> | Right |
16:38 | <@Moltare> | Um, afair, Dev-C++ will bitch and not move on at all |
16:39 | <@Moltare> | Although that might have been a different error I'm thinking of |
16:39 | <@McMartin> | It should be distinguishing warnings from errors |
16:39 | <@McMartin> | If you have "treat warnings as errors" checked, your life will indeed be pain. |
16:41 | <@Moltare> | I don't even see that as an option in the options dialogue or in the help file. I've got a "suppress all warnings" option not checked, if that helps |
16:41 | <@McMartin> | That shouldn't be necessary |
16:43 | | Molgorn [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has joined #code |
16:43 | < Molgorn> | sodding home network |
16:43 | <@McMartin> | "That shouldn't be necessary" |
16:43 | < Molgorn> | "Right" |
16:43 | < Molgorn> | >Disconnected |
16:44 | < Molgorn> | thanks |
16:44 | | Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has quit [Ping Timeout] |
16:44 | | Molgorn is now known as Moltare |
16:44 | <@McMartin> | I suspect something wacky related to bison and the %token<*string> |
16:45 | < Moltare> | To be honest, I'm not at all sure I'm doing that right |
16:45 | < Moltare> | It's either got a value, which is a number, or a string, which is a character. |
16:45 | <@McMartin> | A, uh, skim of some random bison code I found on the Internet makes me wonder if you can in fact drop the * there. |
16:45 | < Moltare> | Should I be doing something with unions? |
16:46 | <@McMartin> | Apparently that's if you don't mess with YYSTYPE. |
16:46 | < Moltare> | which I did. fair enough. |
16:47 | <@McMartin> | In *fact*, I'm wondering if it's necessary at all |
16:47 | <@McMartin> | I think you can actually just say %token NUMBER VARIABLE OP_MULT etc. |
16:47 | <@McMartin> | And they'll all then be TREE *s. |
16:47 | <@McMartin> | Which is what you want |
16:48 | <@McMartin> | %type on the other hand you don't need at all. |
16:48 | <@McMartin> | I think |
16:48 | <@McMartin> | Mabe |
16:49 | < Moltare> | Without it, bison cries. |
16:49 | <@McMartin> | <-- tends to roll his own parsers without dicking with other people's tools |
16:49 | <@McMartin> | What if you remove the <value> line? |
16:50 | < Moltare> | Doesn't break anything new, at least |
16:51 | < Moltare> | hm |
16:51 | <@McMartin> | afk again for a bit |
16:52 | < Moltare> | With that define YYSTYPE TREE thing, do I even need to tell it yylval is a tree? it's giving me multiple declarations |
16:52 | <@McMartin> | I think you might not have to, at least in the .y |
16:52 | <@McMartin> | Not sure about th e.l |
16:52 | < Moltare> | Well, removing it fixes another error, at least |
16:52 | < Moltare> | and causes two other errors to be replaced with duplicates of existing ones |
16:53 | | * Moltare restarts Dev-C++, is presented with just four errors, huzzah |
16:54 | < Moltare> | ...all of them complaining about my declarations |
16:54 | | Vornicus-Latens is now known as Vornicus |
16:56 | < Moltare> | ah, needed to slap stuff in the header file |
16:57 | < Moltare> | ...can I overload stuff in C? |
16:58 | < Moltare> | like, make a makenode(char c, int etc) and a makenode(int v, int etc) |
17:01 | | * Moltare sods it, just makes a makeothernode instead |
17:01 | < Moltare> | one compiler error left! |
17:01 | < Moltare> | and it's the one bleating about yyin, of all things |
17:02 | | EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has quit [Ping Timeout] |
17:02 | < Moltare> | ...oh, duh |
17:03 | | EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has joined #code |
17:03 | < Moltare> | ...no, that should have fixed it |
17:04 | | EvilDarkLord is now known as NSGuest-6279 |
17:06 | < Moltare> | woo, cut it down to zero errors |
17:07 | < Moltare> | Now I get a fresh set of nineteen from the compiler/linker stage to celebrate |
17:07 | < Moltare> | -_- |
17:07 | | * Vornicus patpats Mol |
17:07 | < Moltare> | yyvsp? yymsg? I've not even /heard/ of these |
17:07 | < Moltare> | bison is supposed to conveniently deal with them so I don't have to |
17:10 | <@McMartin> | That sounds like some of the .o files are missing from the project list or something. |
17:11 | <@McMartin> | Bison is, in fact, generating those and then not actually defining them. |
17:11 | <@McMartin> | Or it's defining them, but Dev-C++ isn't telling the linker about it. |
17:11 | | You're now known as TheWatcher[afk] |
17:12 | < Moltare> | hng |
17:12 | <@McMartin> | Can you repaste? If it's a Dev-C++ issue it should build from my terminal. |
17:15 | < Moltare> | Gladly |
17:15 | < Moltare> | (OMG OPZ PLZ) |
17:16 | <@McMartin> | Of course, if it is, then I'll have no idea how to fix it |
17:16 | <@McMartin> | But your code will be right! |
17:16 | < Moltare> | Less "right" and more "capable of compiling", I suspect |
17:16 | | mode/#code [+o Moltare] by jerith |
17:16 | <@Moltare> | http://rafb.net/p/tZdJoF73.html |
17:16 | <@Moltare> | ta |
17:17 | <@McMartin> | Once this actually works, there's another "best practice" to share but it's not necessary right now |
17:17 | <@jerith> | Unless I've screwed something up, you should be autovoiced here now. |
17:17 | <@McMartin> | But is another "C, you ignorant slut" issue |
17:19 | <@Moltare> | My primary interpretation of "C" is always "C_tiger" rather than "C the irritating systems programming language", and I keep laughing and then feeling bad :/ |
17:19 | <@McMartin> | (If you think C is bad you should have seen its predecessors ;_;) |
17:19 | <@McMartin> | (At least C *has* struct) |
17:20 | <@McMartin> | Wow. the compiler freaked out here. I wonder if I mispasted. |
17:20 | <@Moltare> | Nope, sounds about right |
17:21 | <@Moltare> | nineteen errors of varying horror featuring the guts of bison? |
17:21 | <@McMartin> | There's an error in def.h, too |
17:21 | <@McMartin> | "typedef tree_struct TREE" needs a "struct" between typedef and tree_struct |
17:22 | <@Moltare> | ...how does it even send to the linker when there are keywords missing from central declarations of the damned thing? |
17:23 | <@McMartin> | Dev-C++ is, indeed, confused |
17:23 | <@McMartin> | Or I'm looking at a mispaste or something |
17:23 | <@McMartin> | Also |
17:24 | <@McMartin> | #define YYSTYPE *TREE doesn't work because #define is not a typedef, but instead a text substitution |
17:24 | <@McMartin> | So when it tries to declare things of type YYSTYPE it comes out "*TREE val;", which isn't right |
17:24 | <@McMartin> | #define YYSTYPE TREE * |
17:24 | <@McMartin> | Actually, no, worse |
17:24 | <@McMartin> | It comes out "*TREE; val;" |
17:24 | <@McMartin> | It copies the semicolon too |
17:25 | <@McMartin> | As a rule, any line that starts with # is going to the preprocessor which is a search-and-replace whore |
17:25 | <@McMartin> | Don't put comments, otherwise mandatory C syntax, or anything else on it |
17:26 | <@McMartin> | Fixing that removes all errors from the y.tab.c guts. |
17:26 | <@McMartin> | I still have a hojillion errors in y. itself, though. |
17:27 | <@Moltare> | OH GOD WHAT |
17:27 | <@McMartin> | At which? |
17:27 | <@Moltare> | replacing #define YYSTYPE *TREE; with #define YYSTYPE TREE * causes the compiler to explode into thirty new pre-linkage errors |
17:27 | <@McMartin> | Yeah. |
17:27 | <@McMartin> | Now looking into that. |
17:28 | <@Moltare> | They all seem to be complaining that yyval->value is a TREE*, but it's quite clearly an int |
17:29 | <@McMartin> | I'm seriously wondering if that %type thing isn't supposed to go with that %union bullshit. |
17:29 | <@McMartin> | But dropping the <> makes it bitch |
17:30 | <@McMartin> | ... |
17:30 | <@McMartin> | The plot thinkens |
17:30 | <@McMartin> | thickens |
17:30 | <@McMartin> | OK, a metric shitload of errors goes away if you kill the %type declarator entirely |
17:31 | <@McMartin> | The remaining errors have to do with your expression actions, I think. |
17:31 | <@McMartin> | You're trying to subtract TREE *s, so $$ = $1 - $3 and such Aren't Right. |
17:31 | <@McMartin> | I think you'll want $$ = makenode($1.value - $3.value, etc. etc.) |
17:32 | <@Moltare> | oh, of course >_< |
17:32 | <@Moltare> | $1->value ? |
17:32 | <@McMartin> | That doesn't explain the linker errors, though =P |
17:32 | <@McMartin> | Er. right |
17:32 | <@Moltare> | just checking |
17:32 | <@McMartin> | $1 is a TREE *, not a TREE |
17:34 | <@McMartin> | The thing about search-and-replace whoring I was mentioning before was that if you have two files that #include each other, compilation will never finish |
17:34 | <@McMartin> | And there's some boilerplate you can put into .h files to make this Not Happen. |
17:34 | <@McMartin> | Not really a problem for def.h though since it doesn't #include anything |
17:35 | <@McMartin> | Man, bison really does an astonishingly poor job of hiding its internals. =P |
17:38 | <@McMartin> | The other set of errors involves yyerror, which you're treating as if it were printf |
17:38 | <@McMartin> | And either it isn't, or it should actually be "yyerror (char *, ...)". |
17:38 | <@McMartin> | Looking into that now. |
17:39 | <@Moltare> | again, just code I nicked from... somewhere |
17:40 | <@McMartin> | Yeah, this is wacky, and I'm not clear how this works |
17:40 | <@McMartin> | Aren't there supposed to be teaching assistants to provide groundwork for readings and stuff? |
17:40 | <@McMartin> | This screams out for a lab tutorial of some kind |
17:41 | <@Moltare> | Nope, just ffitch |
17:41 | <@Moltare> | And while he'd be open to speaking with, this is 10% of a module while the thing that had a deadline on Friday was 100% of one. |
17:41 | <@Moltare> | No labs, no tutorials |
17:42 | <@McMartin> | OK, the easiest way to fix the yerror problem is to remove the %s bits from the yerror calls and just making them opaque "NO YUO" statements. |
17:43 | <@Moltare> | indeed |
17:43 | <@Moltare> | It'll do |
17:43 | <@Moltare> | just down to the "non-lvalue in assignment" four now |
17:43 | <@McMartin> | While we're at it, main should actually return an int. |
17:44 | <@McMartin> | (0, to be precise, is "program terminated normally") |
17:44 | <@McMartin> | Oh |
17:45 | <@McMartin> | You're also running afoul of the fact that assignments can be expressions. |
17:45 | <@McMartin> | So "if (checkType($1) = 0)" means "attempt to assign 0 to the return value of checktype($1)". |
17:45 | <@McMartin> | You want those to be == |
17:46 | <@Moltare> | ...blar, that one I /should/ have known |
17:46 | <@Moltare> | ...it... compiled |
17:47 | <@McMartin> | Hum. It occurs to me that you may need to do something to compensate for the fact that some numbers are ints and some are floats. |
17:47 | <@McMartin> | Or not, if you're just casually turning ints into floats in flex, I guess |
17:48 | <@McMartin> | Or, uh, actually, it looks like you're turning floats into ints. You may want to make "value" be a double instead of an int. |
17:48 | <@Moltare> | I don't know what I'm turning to what~ The plan was to get it doing /something/ and then worry about fancy tweaks like doing the 'right' thing |
17:49 | <@McMartin> | Righto |
17:49 | <@McMartin> | Note that doing math on pointers is legal but more or less does nothing other than trash your memroy. |
17:49 | <@McMartin> | memory |
17:49 | <@McMartin> | Which is why the $$ = $1 - $3 line is producing warnings at most |
17:50 | <@Moltare> | The way Bison was described to us, the entire content of it should have been a few lines of $$ = $1 - $3 or similar, with maybe a definition or two up the top and a main function down below. :P |
17:51 | <@McMartin> | Sure, if all you're doing is evaluating it. =P |
17:51 | <@Moltare> | The fact that all the tutorials go no further, except for one which goes from that to "How to do a C compiler in bison", reinforced this |
17:52 | <@McMartin> | There's more going on here than just evaluating it, though it does seem like that's the main goal. |
17:52 | <@McMartin> | What is the actual assignment here? |
17:53 | | NSGuest-6279 is now known as EvilDarkLord |
17:53 | <@Moltare> | "Create a parser that makes and outputs a parse tree for the language defined by the following grammar: etc etc etc" |
17:54 | <@Moltare> | "Check that variables are not used except between being defined (by D for integers or F for floats) and being undefined (by U)" |
17:54 | <@McMartin> | Aha |
17:54 | <@McMartin> | OK, in that case |
17:54 | <@McMartin> | The - and * things are totally broken and not apposite to the problem at all |
17:54 | <@McMartin> | That's for working out what the actual value is. |
17:54 | <@Moltare> | "Also modify - and * so that they become -int, *int, -float or *float as appropriate" |
17:55 | | * McMartin nods |
17:56 | <@McMartin> | OK, so, that means you're going to be returning, instead of $1 - $3, something like makeoperatornode ("-", 3, $1, $3) or something |
17:56 | <@Moltare> | Again, the original plan was to make something that worked and then modify it |
17:56 | <@McMartin> | $1 and $3 will be your left and right subtrees for the compound expressions. |
17:56 | <@McMartin> | Yeah. |
17:56 | <@McMartin> | What I'm saying here is "Warnings or Horrific Failures stemming from the $$ = $1 op $3 lines can be ignored" |
17:57 | <@McMartin> | Since the modification will involve, you know, getting rid of those lines entirely and replacing them with what the assignment says |
17:57 | <@Moltare> | aye |
17:58 | <@McMartin> | So yeah, at this point it looks like the bullshit has largely been trimmed. |
17:59 | <@Moltare> | Need to make it do the right things, and also need to make it create an actual executable which accepts input and does something with it |
17:59 | <@Moltare> | Next step, then! onwards~ |
17:59 | <@McMartin> | That second one comes later, actually. |
17:59 | <@Moltare> | Well, yes |
17:59 | <@McMartin> | Which makes testing a bit rough, but. |
17:59 | <@Moltare> | But at least step one is done |
18:00 | <@McMartin> | When is this due, anyway? |
18:01 | <@Moltare> | Tomorrow, midday ¬¬ |
18:01 | <@McMartin> | Elch. |
18:01 | <@Moltare> | Oh yes. |
18:02 | <@Moltare> | But, again, 100% of one module > 10% of another in terms of Command On My Effort |
18:02 | <@McMartin> | Indeed. |
18:02 | | * McMartin heads off to do laundry. |
18:02 | <@Moltare> | Thank you for your help. |
18:02 | <@McMartin> | No worries. |
18:02 | | * McMartin only spent six months or so being paid to do this. |
18:04 | <@McMartin> | Albeit mostly on the "OK, we have a parse tree, now what?" stuff |
18:04 | <@McMartin> | (ML is sooooo much better for parsers. It's a pity the language isn't actually useful for anything else. ;_;) |
18:21 | | You're now known as TheWatcher |
18:22 | | * Moltare replaces all the placeholders with potentially useful stuff |
18:22 | <@Moltare> | It compiles still! |
18:23 | < Vornicus> | Gasp! |
18:23 | <@Moltare> | I /know/ |
18:23 | | mode/#code [+o Vornicus] by jerith |
18:23 | <@Moltare> | shocking |
18:23 | | mode/#code [+oooooo Attilla Chalain EvilDarkLord JeffL Pi Shoukanjuu] by Vornicus |
18:23 | | mode/#code [+v DiceBot] by Vornicus |
18:34 | <@Moltare> | ...I don't think I even needed OP_MINUS and OP_MULT |
18:34 | <@Moltare> | no wate, I did |
18:35 | <@Moltare> | I think |
18:37 | | * Moltare writes up his test plan, expected results, notes and comments now anyway, since that's a productive thing to do |
18:54 | <@McMartin> | You'll some way to note which tree nodes are actually -/*, as well as the types thereon |
18:56 | <@Moltare> | aye |
18:57 | <@Moltare> | ...I think I've got that, an'all |
20:24 | | Vornicus [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout] |
20:32 | | Vornicus [~vorn@Admin.Nightstar.Net] has joined #code |
20:32 | | mode/#code [+o Vornicus] by ChanServ |
21:01 | | Vornicus is now known as Finerty |
21:16 | | JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has quit [Ping Timeout] |
21:16 | | JeffL [~JPL@Nightstar-12594.dsl.sndg02.pacbell.net] has joined #code |
21:19 | | AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has joined #code |
21:29 | | AFKSkull is now known as ASCIISkull |
22:01 | | Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has quit [Connection reset by peer] |
22:09 | | Moltare [~moltare@Nightstar-29340.cable.ubr02.bath.blueyonder.co.uk] has joined #code |
22:09 | | mode/#code [+v Moltare] by ChanServ |
22:27 | | Finerty [~vorn@Admin.Nightstar.Net] has left #code [Leaving] |
22:28 | | Vornicus [~vorn@64.252.33.ns-12695] has joined #code |
22:28 | | mode/#code [+o Vornicus] by ChanServ |
22:29 | | Vornicus is now known as Finerty |
22:53 | | AnnoDomini [AnnoDomini@Nightstar-29716.neoplus.adsl.tpnet.pl] has quit [Quit: Go in wall is poison.] |
23:14 | | Finerty is now known as Vornicus |
--- Log closed Mon Apr 28 00:00:14 2008 |