Skip to content

Commit

Permalink
almost done... still must fix JUnit thing for assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
asolanki committed Dec 5, 2011
1 parent 4a6f6a5 commit da08ec6
Show file tree
Hide file tree
Showing 8 changed files with 1,746 additions and 0 deletions.
193 changes: 193 additions & 0 deletions HW4/CS-nightmare.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
From: Steve Jacobson <sjac3@leland.Stanford.EDU>
Subject: newly revised hw1b nightmare grammar
To: zelenski@CS.Stanford.EDU, sjac3@leland.Stanford.EDU, sjacobso@cisco.com
Date: Mon, 27 Apr 1998 13:05:09 -0700 (PDT)
X-Mailer: ELM [version 2.4 PL25]


The hw1b nightmare grammar (newly revised).

This was inspired by a fitful night of half-sleep before hw1b
was due. I spent a very long evening writing the darray.c code,
and then had a segmentation fault I was too tired to track down.
I ended up debugging code all night in my sleep, dreaming about
the most bizarre and inconsequential things that could be wrong
(none of which were, of course).

SteveJ


{
<start>
<code-phrase> <failure-reason> because it went <initial-pointer-problem> So I ran it under gdb, but <gdb-problem> So I tried Purify, which told me <purify-problem> I've got to remember to <general-lament>
}
{
<code-phrase>
My <my-code-name> code
My <my-code-name> code
The example search code
The <supplied-code-name> they gave us
The provided <supplied-code-name>
My <my-code-name> code
My <my-code-name> code
}
{
<my-files>
<my-code-name>
<my-headers-name>
}
{
<my-code-name>
DArray
HashTable
old scanner
darray.c
search.c
hashtable.c
old scanner.c
}
{
<my-headers-name>
darray.h
search.h
hashtable.h
old scanner.h
}
{
<supplied-code-name>
scanner.o
darray.o
hashtable.o
old scanner.c
}
{
<failure-reason>
got a segfault
had a bus error
had an alignment error
just hung
went off in the weeds somewhere
went out to lunch
crashed in a spectacular ball of fire
ate the big one and died
went into a death spiral
collapsed in a pile of smoldering wreckage
asserted again
spewed these really bizarre messages
}
{
<initial-pointer-problem>
<initial-pointer-action> <pointer-type> <pointer-problem>
}
{
<pointer-problem>
<pointer-action> <pointer-type> <pointer-problem>
<pointer-action> <pointer-type> <pointer-problem>
<pointer-action> <pointer-type> <pointer-problem>
<pointer-action> <pointer-type> <pointer-problem>
<pointer-action> <pointer-type> <pointer-problem>
and finally dereferenced a NULL *.
and ended up calling a NULL function.
}
{
<initial-pointer-action>
to a
through a
dereferencing a
}
{
<pointer-action>
<initial-pointer-action>
<initial-pointer-action>
which was really a
which should have been a
}
{
<pointer-type>
char **
HashTable *
DArray *
void *
darray []
hasharray []
}
{
<gdb-problem>
I can't remember <gdb-action> <gdb-result> and <gdb-problem>
I wish I knew <gdb-action> <gdb-result> and <gdb-problem>
why won't it <gdb-result> and <gdb-problem>
I forget where I put that darn gdb handout.
I wonder where I put my gdb book.
}
{
<gdb-action>
the command to
the syntax to
how to
the right way to
the best way to
any way to
}
{
<gdb-result>
clear the breakpoints
dump the local variables
dump the parameters
step out of the function
show the stack trace
stop before the crash
}
{
<purify-problem>
I had <purify-error> and <purify-problem>
there's <purify-error> and <purify-problem>
for some reason I got <purify-error> and <purify-problem>
I have to deal with <purify-error> and <purify-problem>
I leaked _all_ my memory.
I leaked 100 percent of my memory.
}

{
<purify-error>
a UMR error
an ABR error
an ABW error
an NPR radio error
an NPW error
a BSR error
a BSW error
a FEE FIE FOE FUM error
a FMR error
a FMW error
a FNH error
}

{
<general-lament>
add some more comments to <my-files> and <general-lament>
try and get some sleep, and <general-lament>
try and use only one late day, and <general-lament>
walk through the <my-code-name> code and <general-lament>
use a Scanner for stdin, and <general-lament>
clean up <my-code-name> a bit and <general-lament>
put those grotesque casts in a helper function, and <general-lament>
pull that ugly hack out of <my-code-name> and <general-lament>
read the header files just one more time.
}


165 changes: 165 additions & 0 deletions HW4/Cool-story-bro.g
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
Cool story bro!
Use this grammar and a random sentence generator
to make up a cool story to impress your friends.
Uses college cliches and UVA stereotypes to
create a story that will likely make you more
popular (no guarantees).

{
<start>
So <date> when I got back at <time> I was so <state-of-detriment> that I <action> <object> and <after-that> I <sexual-action-past-tense> <number> <slang-for-college-student> Then, I went <back-to-house> and told my <slang-college-student-plural> They gave me <gesture> <stupid-hyperbolic-statement>
}

{
<stupid-hyperbolic-statement>
That was the craziest night of my life.
That was so legit.
That was gnarly.
Best day ever.
I'm such a bro.
Cool story bro.
Beast mode on.
So bro.
So chill.
}
{
<gesture>
daps.
drugs.
alcohol.
Four Lokos.
chest bumps.
}
{
<slang-college-student-plural>
bros.
homies.
brahs.
fellow frat stars.
home slices.
}
{
<back-to-house>
back to the house
back to the dorm
back to the frat
back to O-Hill
back to Little John's
}

{
<slang-for-college-student>
peasants.
biddies.
grommets.
frat stars.
bros.
}

{
<number>
like a million
420
69
8008135
5010
5
6
7
1337
}

{
<sexual-action-past-tense>
hooked up with
hung out with
chilled with
powned
high-fived
got my ass signed by
took shots with
}

{
<after-that>
after that
later
afterwards
}

{
<date>
last night,
yesterday,
on my birthday,
on Monday,
last Tuesday,
on Wednesday,
last Thursday,
on Friday,
last Saturday,
on Sunday,
}

{
<time>
1 a.m.
2 p.m.
3 a.m.
4 p.m.
5 a.m.
6 p.m.
7 a.m.
8 p.m.
9 a.m.
10 p.m.
11 a.m.
12 p.m.
}

{
<state-of-detriment>
wasted
baked
hammered
shwasted
drunk
gone
plastered
toasted
high on life
}

{
<action>
peed on
threw up on
climbed
tore down
struck
finished a keg with <number> friends at
}

{
<adverb>
drunkenly
quickly
awkwardly
inadvertently
totally
totes
}

{
<object>
a frat house
a sorority house
O'Hill
Newcomb
a fountain
the quad
the lawn
}
Loading

0 comments on commit da08ec6

Please sign in to comment.