d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Make Me A Better Programmer - From Step 1
Prev1474849505156Next
Add Reply New Topic New Poll
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 22 2014 02:46pm
Quote (carteblanche @ Oct 22 2014 02:01pm)
attack on titan is so much more entertaining to watch than read.

kinkos let a guy print a college parking pass, so who knows?


of course it is, the anime highlights the only good parts of the manga

everything that happens after the anime is boring
Member
Posts: 39,853
Joined: Apr 9 2009
Gold: 4,560.09
Oct 22 2014 11:02pm
Quote (Eep @ Oct 21 2014 06:29pm)
if you need help yeah just post up the problems etc. If you want to you can start your own thread sometime too.

My thread just kind of ended up being the programmers general chat, lol


Okay, The quiz earlier today was really easy.
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Oct 23 2014 12:23am
Quote (AbDuCt @ Oct 22 2014 09:56am)

I also hate reading off LCD screens for long periods of time >.>


Then get an LED you pleb. It's 2014 for fuck's sake.

Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Oct 23 2014 12:26am
Quote (Minkomonster @ Oct 23 2014 02:23am)
Then get an LED you pleb. It's 2014 for fuck's sake.


Damn nazi.
Member
Posts: 62,215
Joined: Jun 3 2007
Gold: 9,039.20
Oct 23 2014 05:58am
Quote (AbDuCt @ Oct 22 2014 12:57am)
Anime > manga.


Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 23 2014 12:38pm
Quote (killg0re @ Oct 23 2014 06:58am)
https://i.imgur.com/Q1M7pLC.jpg


our new mascot, coder-chan
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Oct 23 2014 03:41pm
Quote (Eep @ Oct 23 2014 02:38pm)
our new mascot, coder-chan


Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 23 2014 06:37pm
Quote (AbDuCt @ Oct 23 2014 04:41pm)
http://i.imgur.com/jT57wFi.jpg


this would help all those weebs learn some real world skills!
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Oct 31 2014 03:26am
Quote (AbDuCt @ Oct 22 2014 09:56am)
Everyone knows animated version of dead man wonderland is so much better. *cringes*

Hos do you read your manga? I want to try to find a print shop to print scanlated manga but I don't feel like they would do it due to legal reasons.

I also hate reading off LCD screens for long periods of time >.>


ohh I never responded to this

I read scans on my home monitor :o

never thought about printing them, though as you said, legal issues may arise.

I am a huge seinen fan, though some shounen stuff can be good.

my MAL for manga is http://myanimelist.net/mangalist/Eep, though I haven't updated in a while. There are a few series I have been reading lately I need to add (like genshiken nidaime and spotted flower)

edit cuz url tags are beyond me

double edit because herp

This post was edited by Eep on Oct 31 2014 03:29am
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Nov 6 2014 01:07am
Compilers class, fun times! Minor update about what I've been doing.

Project 1 was to build our scanner function, which is used to produce tokens from our input file and hand them over to the parser.

That one was interesting, as it was my first time implementing a FSA as a table, and using a driver to go from state to state.

Today, I wrapped up the first 1/2 of my 2nd project - building a Top down parser.

Currently, it is a set of functions based on BNF productions. They are all VOID at the moment, but later this week I will have to modify them to build a parse tree.

Some snippets of code:

Code
struct parseNode {
int productionInstance;
token_t token;
struct parseNode *child1, *child2, *child3;
};


Code
struct token_t {
int tokenInstance;
std::string tokenID;
int lineNum;
};


(from scanner)

Code
/*
* Preprocessor function.
* Takes a single character to work on, and the current file stream.
* Keeps track of line numbers, normalizes case sensitivity,
* handles comment processing. Returns a tuple containing
* line # and our character back to the scanner.
*/

charTuple* preprocessor(char c, FILE *fp) {
static int lineNum = 1;
charTuple *tuple = new charTuple;

if (c == '#') {
while (1) {
c = getc(fp);
if (c == '\n') {
lineNum++;
c = ' ';
break;
}
}
}

if (c == '\n') {
lineNum++;
}

if (isalpha(c)) {
tuple->character = tolower(c);
} else {
tuple->character = c;
}

tuple->line = lineNum;

return tuple;
}


(from parser)

Code
void parser(FILE *fp) {
token_t *token = scanner(fp);
program_NT(token, fp);
if (token->tokenInstance == EOFtk) {
printf("Parse OKAY!\n");
} else {
printf("Parser Error: Source code found after 'return' token. Expected EOF.\n");
exit(1);
}
return;
}

void program_NT(token_t *token, FILE *fp) {
var_NT(token, fp);
if (token->tokenInstance == DOtk) {
delete token;
token = scanner(fp);
block_NT(token, fp);
if (token->tokenInstance == RETURNtk) {
delete token;
token = scanner(fp);
} else {
parserError(token, "return");
}
} else {
parserError(token, "do");
}

return;
}

void var_NT(token_t *token, FILE *fp) {
if (token->tokenInstance == VARtk) {
delete token;
token = scanner(fp);
if (token->tokenInstance == IDtk) {
delete token;
token = scanner(fp);
mvars_NT(token, fp);
if (token->tokenInstance == DELIMtk && token->tokenID[0] == '.') {
delete token;
token = scanner(fp);
return;
} else {
parserError(token, ".");
}
} else {
parserError(token, "ID");
}
} else {
return;
}
}

void block_NT(token_t *token, FILE *fp) {
if (token->tokenInstance == STARTtk) {
delete token;
token = scanner(fp);
var_NT(token, fp);
stats_NT(token, fp);
if (token->tokenInstance == FINISHtk) {
delete token;
token = scanner(fp);
} else {
parserError(token, "finish");
}
} else {
parserError(token, "start");
}
return;
}


(test input file we used)

Code
#test 2
var x : y .
do
start
var x .
print 2 - x .
start
var x .
print 1 .
finish
repeat [ x == 0]
start
print 2.
finish
finish
return


This post was edited by Eep on Nov 6 2014 01:29am
Go Back To Programming & Development Topic List
Prev1474849505156Next
Add Reply New Topic New Poll