diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-08 14:33:24 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-08 14:33:24 -0500 |
| commit | 46f6ee5545f0703c1626c8de35a8e6e6217a9b14 (patch) | |
| tree | 385f4a5762299a09cb2e4a7779989c667175623a | |
| parent | 3b07acb43c5f865c65094ae891f5a2dc791c8088 (diff) | |
Update
36 files changed, 6074 insertions, 323 deletions
diff --git a/RGens/data/sample-grammars/24hr-rpg.gram b/RGens/data/sample-grammars/24hr-rpg.gram index 344d9a8..d526e7b 100755 --- a/RGens/data/sample-grammars/24hr-rpg.gram +++ b/RGens/data/sample-grammars/24hr-rpg.gram @@ -1,8 +1,8 @@ -[rpg] [rpg-part] , [rpg-part] and [rpg-part] +[rpg-name] [rpg-part] , [rpg-part] and [rpg-part] [rpg-part] and [rpg-part] [rpg-part] the [rpg-part] -pragma initial-rule [rpg] +pragma initial-rule [rpg-name] [rpg-part] tits teeth diff --git a/RGens/data/sample-grammars/anime.gram b/RGens/data/sample-grammars/anime.gram index 0cc21d8..b83e8be 100755 --- a/RGens/data/sample-grammars/anime.gram +++ b/RGens/data/sample-grammars/anime.gram @@ -1,20 +1,19 @@ -[anime-name] [anime-two-name] - [anime-three-name] +[anime-name] [two-name] + [three-name] pragma initial-rule [anime-name] -pragma export-rule [anime-name] -[anime-two-name] [anime-first-name] [anime-third-name] - [anime-second-name] [anime-third-name] +[two-name] [first-name] [third-name] + [second-name] [third-name] -[anime-three-name] [anime-first-name] [anime-first-name] - [anime-first-name] [anime-second-name] - [anime-second-name] [anime-first-name] - [anime-second-name] [anime-second-name] +[three-name] [first-name] [first-name] + [first-name] [second-name] + [second-name] [first-name] + [second-name] [second-name] -pragma suffix-with [anime-name] [anime-third-name] +pragma suffix-with [anime-name] [third-name] -[anime-first-name] Vampire +[first-name] Vampire Cat Death Mermaid @@ -41,7 +40,7 @@ pragma suffix-with [anime-name] [anime-third-name] Lucid Space -[anime-second-name] Princess +[second-name] Princess Planet Blade Bride @@ -69,7 +68,7 @@ pragma suffix-with [anime-name] [anime-third-name] Blackout Phantom -[anime-third-name] Forever +[third-name] Forever Detectives Memories Outlaw diff --git a/RGens/data/sample-grammars/art-objects.gram b/RGens/data/sample-grammars/art-objects.gram index 0a97edb..4f83ad8 100755 --- a/RGens/data/sample-grammars/art-objects.gram +++ b/RGens/data/sample-grammars/art-objects.gram @@ -1,9 +1,9 @@ -[treasure] [gemstones] +[art-treasure] [gemstones] [art-object] [art-object] as well as [gemstones] [gemstones] as well as [art-object] -pragma initial-rule [treasure] +pragma initial-rule [art-treasure] [art-object] [common-art] [uncommon-art] diff --git a/RGens/data/sample-grammars/awe-names.gram b/RGens/data/sample-grammars/awe-names.gram index 5ecc898..5dedb93 100755 --- a/RGens/data/sample-grammars/awe-names.gram +++ b/RGens/data/sample-grammars/awe-names.gram @@ -1,7 +1,7 @@ -[name] [part] +[awesome-name] [part] [part] [part] -pragma initial-rule [name] +pragma initial-rule [awesome-name] [part] battle blade diff --git a/RGens/data/sample-grammars/college.gram b/RGens/data/sample-grammars/college.gram index f1bee8e..6e657fa 100644 --- a/RGens/data/sample-grammars/college.gram +++ b/RGens/data/sample-grammars/college.gram @@ -72,6 +72,8 @@ pragma range-rule [past-years] 1800 1970 [course-static] [course-static] +pragma export-rule [college-course] + [condition] condition experience @@ -134,6 +136,7 @@ pragma range-rule [past-years] 1800 1970 [studies] studies in perspectives on + [course-env1] saving the world the end of the word the sky is falling diff --git a/RGens/data/sample-grammars/diablo-ii/diabloii.gram b/RGens/data/sample-grammars/diablo-ii/diabloii.gram index d16b4f9..652d38f 100755 --- a/RGens/data/sample-grammars/diablo-ii/diabloii.gram +++ b/RGens/data/sample-grammars/diablo-ii/diabloii.gram @@ -1,9 +1,3 @@ -# Load other files -pragma load-sub-grammar [item-act] diabloiiitems.gram -pragma load-sub-grammar [perishables] diabloiiperish.gram -pragma load-sub-grammar [prefix] diabloiiprefixes.gram -pragma load-sub-grammar [suffix] diabloiisuffixes.gram - [base-treasures] [base-treasure] [base-treasure] as well as [base-treasure] [base-treasure] or [base-treasure] diff --git a/RGens/data/sample-grammars/diablo-ii/diabloiiitems.gram b/RGens/data/sample-grammars/diablo-ii/diabloiiitems.gram index c6abc09..4e1d085 100755 --- a/RGens/data/sample-grammars/diablo-ii/diabloiiitems.gram +++ b/RGens/data/sample-grammars/diablo-ii/diabloiiitems.gram @@ -17,6 +17,8 @@ [inscriptions] [perishables] +pragma export-rule [item-act] + [armor] cape rags cloak diff --git a/RGens/data/sample-grammars/diablo-ii/diabloiiperish.gram b/RGens/data/sample-grammars/diablo-ii/diabloiiperish.gram index 26117d6..f910de8 100755 --- a/RGens/data/sample-grammars/diablo-ii/diabloiiperish.gram +++ b/RGens/data/sample-grammars/diablo-ii/diabloiiperish.gram @@ -2,6 +2,8 @@ [perishable-effect] [perishable-type] [bodypart] of [perishable-effect] +pragma export-rule [perishables] + [bodypart] heart brain jawbone diff --git a/RGens/data/sample-grammars/diablo-ii/diabloiiprefixes.gram b/RGens/data/sample-grammars/diablo-ii/diabloiiprefixes.gram index e9f2072..40b36b0 100755 --- a/RGens/data/sample-grammars/diablo-ii/diabloiiprefixes.gram +++ b/RGens/data/sample-grammars/diablo-ii/diabloiiprefixes.gram @@ -12,6 +12,8 @@ [to-hit+damage] [item-charges] +pragma export-rule [prefix] + [armor-class] sturdy fine strong diff --git a/RGens/data/sample-grammars/diablo-ii/diabloiisuffixes.gram b/RGens/data/sample-grammars/diablo-ii/diabloiisuffixes.gram index 66e264e..80aec16 100755 --- a/RGens/data/sample-grammars/diablo-ii/diabloiisuffixes.gram +++ b/RGens/data/sample-grammars/diablo-ii/diabloiisuffixes.gram @@ -20,6 +20,8 @@ [weapon-use] [spell-casting] +pragma export-rule [suffix] + [damage-reduction] health protection absorption diff --git a/RGens/data/sample-grammars/dungeon-enviroment.gram b/RGens/data/sample-grammars/dungeon-enviroment.gram index f521125..2deb725 100755 --- a/RGens/data/sample-grammars/dungeon-enviroment.gram +++ b/RGens/data/sample-grammars/dungeon-enviroment.gram @@ -1,11 +1,11 @@ -[enviroment] [man-made] +[dungeon-enviroment] [man-made] [cave] [natural] [aquatic] [aerial] [supernatural] -pragma initial-rule [enviroment] +pragma initial-rule [dungeon-enviroment] [man-made] a stone room a spiral staircase surrounding a giant pit diff --git a/RGens/data/sample-grammars/fantasy-locations.gram b/RGens/data/sample-grammars/fantasy-locations.gram index 63a7dca..0dc8aa3 100755 --- a/RGens/data/sample-grammars/fantasy-locations.gram +++ b/RGens/data/sample-grammars/fantasy-locations.gram @@ -1,11 +1,11 @@ pragma uniform -[location-name] 4 [name1] [name2] +[fantasy-location-name] 4 [name1] [name2] 2 [name1] [name1] [name2] pragma uniform -pragma initial-rule [location-name] +pragma initial-rule [fantasy-location-name] [name1] amber angry diff --git a/RGens/data/sample-grammars/firstname-female.long b/RGens/data/sample-grammars/firstname-female.long new file mode 100644 index 0000000..a1c7c1c --- /dev/null +++ b/RGens/data/sample-grammars/firstname-female.long @@ -0,0 +1,532 @@ +Abigail +Ada +Adrienne +Agnes +Alberta +Alexandra +Alexis +Alice +Alicia +Alison +Allison +Alma +Alyssa +Amanda +Amber +Amelia +Amy +Ana +Andre +Andrea +Angel +Angela +Angelica +Angelina +Angie +Anita +Ann +Anna +Anne +Annette +Annie +Antoinette +Antonia +April +Ariane +Ariel +Arlene +Ashley +Audrey +Barbara +Beatrice +Becky +Belinda +Bernadette +Bernice +Bertha +Bessie +Beth +Bethany +Betsy +Betty +Beulah +Beverly +Billie +Blanca +Blanche +Bobbie +Bonnie +Brandi +Brandy +Brenda +Brianna +Bridget +Brittany +Brooke +Caitlin +Camille +Candace +Candice +Carla +Carmen +Carol +Carole +Caroline +Carolyn +Carrie +Casey +Cassandra +Catherine +Cathy +Cecelia +Cecilia +Celia +Charlene +Charlotte +Chelsea +Cheryl +Chloe +Christian +Christie +Christina +Christine +Christy +Cindy +Claire +Clara +Claudia +Colleen +Connie +Constance +Cora +Courtney +Cristina +Crystal +Cynthia +Daisy +Dana +Danielle +Darla +Darlene +Dawn +Deanna +Debbie +Deborah +Debra +Delia +Della +Delores +Denise +Desiree +Diana +Diane +Dianna +Dianne +Dion +Dixie +Dolores +Dominique +Donna +Dora +Doreen +Doris +Dorothy +Ebony +Edith +Edna +Eileen +Elaine +Eleanor +Elena +Elisa +Elizabeth +Ella +Ellen +Eloise +Elsa +Elsie +Elvira +Emily +Emma +Erica +Erika +Erin +Erma +Ernestine +Essie +Estelle +Esther +Ethel +Eula +Eunice +Eva +Evelyn +Faith +Fannie +Faye +Felicia +Felicity +Flora +Florence +Frances +Francis +Freda +Gabriel +Gabrielle +Gail +Gayle +Geneva +Genevieve +Georgia +Geraldine +Gertrude +Gina +Ginger +Gladys +Glenda +Gloria +Grace +Gretchen +Guadalupe +Gwen +Gwendolyn +Haley +Hannah +Harriet +Hattie +Hazel +Heather +Heidi +Helen +Henrietta +Hilda +Hillary +Holly +Hope +Ida +Inez +Irene +Iris +Irma +Isabel +Isabella +Jackie +Jacqueline +Jacquelyn +Jade +Jaime +Jamie +Jan +Jana +Jane +Janet +Janice +Janie +Janis +Jasmine +Jean +Jeanette +Jeanne +Jeannette +Jeannie +Jenna +Jennie +Jennifer +Jenny +Jessica +Jessie +Jill +Jo +Joan +Joann +Joanna +Joanne +Jodi +Jody +Johanna +Johnnie +Josefina +Josephine +Joy +Joyce +Juana +Juanita +Judith +Judy +Julia +Julie +June +Kaitlyn +Kara +Karen +Kari +Karla +Kate +Katelyn +Katherine +Kathleen +Kathryn +Kathy +Katie +Katrina +Kay +Kayla +Kelley +Kelli +Kellie +Kelly +Kelsey +Kendra +Kerry +Kim +Kimberly +Krista +Kristen +Kristi +Kristie +Kristin +Kristina +Kristine +Kristy +Krystal +Lana +Latoya +Laura +Lauren +Laurie +Laverne +Leah +Lee +Leigh +Lela +Lena +Leona +Leslie +Leticia +Lila +Lillian +Lillie +Linda +Lindsay +Lindsey +Lisa +Lois +Lola +Lora +Lorena +Lorene +Loretta +Lori +Lorraine +Louise +Lucia +Lucille +Lucy +Lula +Luz +Lydia +Lynda +Lynette +Lynn +Lynne +Mabel +Mable +Mackenzie +Madeline +Madison +Mae +Magdalena +Maggie +Mamie +Mandy +Marcella +Marcia +Margaret +Margarita +Marge +Margie +Marguerite +Maria +Mariah +Marian +Marianne +Marie +Marilyn +Marion +Marjorie +Marlene +Marsha +Marta +Martha +Mary +Maryann +Mattie +Maureen +Maxine +May +Megan +Meghan +Melanie +Melba +Melinda +Melissa +Melody +Mercedes +Meredith +Michele +Michelle +Mildred +Mindy +Minnie +Miranda +Miriam +Misty +Molly +Mona +Monica +Monique +Morgan +Muriel +Myra +Myrtle +Nadine +Nancy +Naomi +Natalie +Natasha +Nellie +Nettie +Nichole +Nicole +Nina +Nora +Norma +Olga +Olive +Olivia +Ollie +Opal +Ora +Paige +Pam +Pamela +Pat +Patricia +Patsy +Patti +Patty +Paula +Paulette +Pauline +Pearl +Peggy +Penny +Phyllis +Priscilla +Rachael +Rachel +Ramona +Raquel +Raven +Rebecca +Regina +Renee +Rhonda +Rita +Roberta +Robin +Robyn +Rochelle +Rosa +Rosalie +Rose +Rosemarie +Rosemary +Rosie +Roxanne +Ruby +Ruth +Sabrina +Sadie +Sally +Samantha +Sandra +Sandy +Sara +Sarah +Shannon +Shari +Sharon +Shawna +Sheila +Shelia +Shelley +Shelly +Sheri +Sherri +Sherry +Sheryl +Shirley +Silvia +Sonia +Sonja +Sonya +Sophia +Sophie +Stacey +Stacy +Stella +Stephanie +Sue +Susan +Susie +Suzanne +Sydney +Sylvia +Tabitha +Tamara +Tami +Tammy +Tanya +Tara +Tasha +Taylor +Teresa +Teri +Terri +Terry +Thelma +Theresa +Tiffany +Tina +Toni +Tonya +Tracey +Traci +Tracy +Tricia +Valerie +Vanessa +Velma +Vera +Verna +Veronica +Vicki +Vickie +Vicky +Victoria +Viola +Violet +Virginia +Vivian +Wanda +Wendy +Whitney +Willie +Wilma +Winifred +Yasmine +Yolanda +Yvette +Yvonne +Zoe diff --git a/RGens/data/sample-grammars/firstname-male.long b/RGens/data/sample-grammars/firstname-male.long new file mode 100644 index 0000000..f6d3ce5 --- /dev/null +++ b/RGens/data/sample-grammars/firstname-male.long @@ -0,0 +1,624 @@ +Aaron +Abel +Abraham +Adam +Adolph +Adrian +Al +Alan +Albert +Alberto +Alejandro +Alex +Alexander +Alfonso +Alfred +Alfredo +Allan +Allen +Alonzo +Alton +Alvin +Amos +Andre +Andreas +Andres +Andrew +Andy +Angel +Angelo +Angus +Anthony +Antoine +Anton +Antonio +Archie +Armando +Arnold +Art +Arthur +Arturo +Aubrey +Aubrie +Austin +Barry +Bart +Bayard +Ben +Benjamin +Bennie +Benny +Benoit +Bernard +Bernhard +Bert +Bill +Billy +Blake +Bob +Bobby +Boris +Boyd +Brad +Bradford +Bradley +Brandon +Brendan +Brent +Brett +Brian +Bruce +Bruno +Bryan +Bryant +Bryce +Byron +Caleb +Calvin +Cameron +Carl +Carlos +Carlton +Carroll +Cary +Casey +Cecil +Cecilie +Cedric +Cesar +Chad +Charles +Charlie +Chester +Chris +Christian +Christopher +Clarence +Clark +Claude +Clay +Clayton +Cliff +Clifford +Clifton +Clint +Clinton +Clyde +Cody +Cole +Colin +Connor +Conrad +Corey +Cornelius +Cory +Courtney +Craig +Crispin +Curtis +Dale +Dallas +Damon +Dan +Dana +Daniel +Danny +Darin +Darnell +Darrel +Darrell +Darren +Darrin +Darryl +Daryl +Dave +David +Dean +Delbert +Dennis +Derek +Derrick +Deven +Devin +Dewey +Dexter +Dick +Diego +Dieter +Dimitri +Dimitrius +Domingo +Dominic +Dominick +Dominique +Don +Donald +Donnie +Doug +Douglas +Doyle +Drazen +Drew +Duane +Dustin +Dwayne +Dwight +Dylan +Earl +Earnest +Ed +Eddie +Edgar +Edmond +Edmund +Eduardo +Edward +Edwin +Elbert +Elias +Elijah +Ellis +Elmer +Emanuel +Emilio +Emmett +Enrico +Enrique +Eric +Erick +Erik +Ernest +Ernesto +Ervin +Ethan +Eugene +Evan +Everett +Felipe +Felix +Fernando +Floyd +Forrest +Fox +Francis +Francisco +Frank +Frankie +Franklin +Franky +Fred +Freddie +Freddy +Frederic +Frederick +Fredrick +Fredrik +Gabe +Gabriel +Garrett +Garry +Garth +Gary +Gavin +Gene +Geoff +Geoffrey +George +Gerald +Gerard +Gerardo +Gilbert +Gilberto +Glen +Glenn +Gordon +Grady +Graham +Grant +Greg +Gregg +Gregor +Gregory +Guadalupe +Guillermo +Gunnar +Gustavo +Guy +Hans +Harold +Harry +Harvey +Hector +Henrik +Henry +Herald +Herb +Herbert +Herman +Homer +Horace +Howard +Hubert +Hugh +Hugo +Hunter +Iain +Ian +Ignacio +Igor +Ira +Irvin +Irving +Isaac +Ismael +Israel +Ivan +Jack +Jackie +Jacob +Jacques +Jaime +Jake +James +Jamie +Jan +Jared +Jarret +Jason +Javier +Jay +Jean +Jeff +Jeffery +Jeffrey +Jerald +Jeremiah +Jeremy +Jermaine +Jeroen +Jerome +Jerry +Jesse +Jessie +Jesus +Jim +Jimmie +Jimmy +Jody +Joe +Joel +Joey +Johan +John +Johnathan +Johnnie +Johnny +Jon +Jonathan +Jonathon +Jordan +Jorge +Jose +Joseph +Josh +Joshua +Juan +Julian +Julio +Julius +Justin +Karl +Karlo +Kasper +Keith +Kelly +Kelvin +Ken +Kenneth +Kenny +Kent +Kerry +Kevin +Kim +Kirk +Klaus +Kris +Kristian +Kristopher +Kurt +Kyle +Lamar +Lance +Larry +Lars +Lauren +Laurence +Laurie +Lawrence +Lee +Leland +Lenny +Leo +Leon +Leonard +Leonardo +Leroy +Leslie +Lester +Levi +Lewis +Lex +Liam +Lindsay +Linus +Lionel +Lloyd +Logan +Lonnie +Loren +Lorenzo +Louis +Lowell +Lucas +Luigi +Luis +Luke +Luther +Lyle +Lynn +Mack +Magnus +Malcolm +Manuel +Marc +Marcelo +Marco +Marcos +Marcus +Marek +Mario +Marion +Mark +Marlon +Marshall +Martin +Marty +Marvin +Mathew +Matt +Matthew +Matthias +Maurice +Max +May +Mel +Melvin +Merle +Michael +Micheal +Miguel +Mike +Miles +Milton +Mitch +Mitchell +Morris +Morten +Moses +Muhammed +Myron +Nathan +Nathaniel +Neal +Ned +Neil +Nelson +Neville +Nic +Nicholas +Nick +Nicola +Nicolas +Niels +Nigel +Nils +Noah +Noel +Norbert +Norm +Norman +Oliver +Omar +Orion +Orlando +Orville +Oscar +Otis +Owen +Pablo +Pat +Patrick +Paul +Paulo +Pedro +Percy +Perry +Pete +Peter +Phil +Philip +Philippe +Phillip +Pierre +Preston +Rafael +Ralph +Ramiro +Ramon +Randal +Randall +Randolph +Randy +Rasmus +Raul +Ray +Raymond +Reginald +Reinhard +Rene +Rex +Rhys +Ricardo +Richard +Rick +Rickey +Ricky +Rob +Robbie +Robert +Roberto +Robin +Rod +Roderick +Rodney +Rodolfo +Rodrigo +Roel +Roelof +Rogelio +Roger +Roland +Rolando +Rolf +Roman +Ron +Ronald +Ronnie +Roosevelt +Rory +Ross +Roy +Ruben +Rudolph +Rudy +Rufus +Russ +Russell +Ryan +Salvador +Salvatore +Sam +Sammy +Samuel +Sander +Santiago +Santos +Saul +Scott +Sean +Sergei +Sergio +Seth +Shane +Shannon +Shaun +Shawn +Sheldon +Sherman +Sid +Sidney +Simon +Skip +Slobodan +Sonny +Spencer +Stan +Stanley +Stefan +Stein +Stephan +Stephano +Stephen +Steve +Steven +Stewart +Stuart +Sulaiman +Sunny +Susie +Sven +Sylvester +Taylor +Ted +Terence +Terrance +Terrell +Terrence +Terry +Thad +Theodore +Thomas +Tim +Timmy +Timothy +Toby +Todd +Tom +Tomas +Tommie +Tommy +Tony +Tracy +Travis +Trevor +Trey +Tristan +Troy +Tyler +Tyrone +Vernon +Victor +Vince +Vincent +Virgil +Wade +Wallace +Walter +Warren +Wayne +Wendell +Wesley +Wilbert +Wilbur +Wilfred +Will +Willard +William +Willie +Willis +Wilson +Winston +Woodrow +Xavier +Yuri +Zachary diff --git a/RGens/data/sample-grammars/fortune.gram b/RGens/data/sample-grammars/fortune.gram new file mode 100644 index 0000000..8ab63b1 --- /dev/null +++ b/RGens/data/sample-grammars/fortune.gram @@ -0,0 +1,74 @@ +[fortune-cookie] you will buy a new set of clothes + you will be hit over the head with a piano falling from a [ordinal] floor window + you will be audited by the irs + you will be audited by the irs because of your activity in the [org-political] + you will be help hostage by the radical [org-political] + you will be run over by a [bus] + you will find yourself as the victim of a bizzare practical joke + you will contract a rare form of [last-name] 's disease + you will grow fat and bald + you will lose your present job and have to become a [job] + you will run for public office and only recieve [half-digit] % of the vote + your spouse will eventually find out about you-know what + you will accidentally run over your neighbor's pet [animal] and be sued for [half-digit] million dollars. + you will arrive late at work only to realize that it's a federal holiday + you will write a perl script to spit out random text + your family will grow suspicious of your newly acquired tattoo + you will recieve a promotion, only to be terminated a month later by failing a random drug test + you will spend the next [weekday] days fighting a flaw in a microsoft product + you will become the leader of the [org-political] + you will lose your job because of your involvement in the [org-political] + you will find the perfect joke to play on your [relative] on april fool's day, only to discover that it's actually april 2nd + your television will explode while the [big-game] is on + you will recieve a [digit-no0] [digit] [digit] , [digit] [digit] [digit] [bill-type] bill by mistake + you will find a counterfeit [counter-bill] bill on the ground + you will discover that everybody really is out to get you + you will become successful in business -- unfortunately, that business will violate the laws of [state-num] + you will inherit [swamp] acres of worthless swampland from your relative + along with [half-digit2] billion cockroaches, you will be the only survivor of world war II + you will save the world -- Bob's Auto World that is + you will move into a mobile home park and then a tornado will strike the very next day + you will set a record high golf score + a black cat will run across your path today, but thankfully you aren't superstitious (at least not until you get run over by a bus this evening + the engine in your [vehicle] will explode precisely [digit] . [digit] seconds after your warranty expires + while on a business trip to [real-city] you will get lost and wind up in [real-city] + you will shoot your eye out with a BB gun, just as your mother said you would + you will run out of gas on Interstate [interstate-num] in the vicinity of nowhere, [us-state] , population [low-num] + your website will be hit with the dreaded slashdot effect, causing your webserver to die a painful death + you will be abducted by aliens and taken to the secret planet [random-name] [roman-num] for extensive probing + you will become the editor for a tabloid newspaper + +pragma initial-rule [fortune-cookie] + +pragma range-rule half-digit 1 5 +pragma range-rule weekday 2 7 +pragma range-rule states 40 80 +pragma range-rule swamp 40 80 +pragma range-rule half-digit2 5 9 +pragma range-rule interstate-num 4 99 +pragma range-rule low-num 1 25 + +[vehichle] car + truck + suv + minivan + +[bus] cross-town bus + beer truck + police car + +[big-game] super bowl + world series + big game + +[bill-type] hospital + car repair + credit card + +[counter-bill] 3 + 5 + 10 + 13 + 20 + 50 + 100 diff --git a/RGens/data/sample-grammars/horror.gram b/RGens/data/sample-grammars/horror.gram index 1e73911..07d84de 100644 --- a/RGens/data/sample-grammars/horror.gram +++ b/RGens/data/sample-grammars/horror.gram @@ -1,6 +1,6 @@ -[horror] [first] [second] [third] +[horror-movie] [first] [second] [third] -pragma initial-rule [horror] +pragma initial-rule [horror-movie] [first] attack of the invasion of the @@ -30,4 +30,4 @@ pragma initial-rule [horror] zombies sock puppets death bots - snuggle badgers
\ No newline at end of file + snuggle badgers diff --git a/RGens/data/sample-grammars/insults.gram b/RGens/data/sample-grammars/insults.gram index 1b3881b..59a4108 100644 --- a/RGens/data/sample-grammars/insults.gram +++ b/RGens/data/sample-grammars/insults.gram @@ -1,6 +1,6 @@ -[insult] Thou [insult-1] [insult2] [insult3]! +[shakesphere-insult] Thou [insult-1] [insult2] [insult3]! -pragma initial-rule [insult] +pragma initial-rule [shakesphere-insult] [insult-1] artless bawdy diff --git a/RGens/data/sample-grammars/lastname.long b/RGens/data/sample-grammars/lastname.long new file mode 100644 index 0000000..4dc6721 --- /dev/null +++ b/RGens/data/sample-grammars/lastname.long @@ -0,0 +1,3377 @@ +abbey +abbott +abel +abrams +acar +acosta +acs +adair +adams +adamson +adkins +adler +adrian +agius +agnew +aguilar +akers +albers +alberts +albrecht +albright +aldredge +aldrich +alexander +allan +allen +alley +allison +althouse +alvarado +alvarez +anderson +andreasson +andrews +angelos +anglin +anstead +anstrom +anthony +arak +aral +arbuckle +archer +armstrong +arnett +arnold +arruda +arthur +ashbridge +ashcroft +asher +ashley +ashton +assler +atchley +atkins +atkinson +atwood +auger +austin +avila +ayala +ayers +babcock +bach +backer +bacon +bailey +baird +baker +baldwin +ball +ballard +bane +bang +banke +banks +barber +barbosa +barger +barker +barnes +barnett +barr +barrenechea +barrett +barrick +barringer +barron +barrow +barry +barta +barter +barth +bartle +bartlett +barton +baruch +bashford +bass +bassett +bates +bauer +baughn +bauman +baumunk +baur +baxter +bayley +bazin +bea +beach +beadles +beam +beaman +bean +beard +beasley +beasly +beason +beavers +beck +becker +bee +beeckmans +beesley +beggs +behrens +belcher +bell +beloof +benanti +benedict +benge +benham +benner +bennett +bennitt +benson +bentley +benton +benware +beresford +bereznai +berezniker +berg +bergen +bergren +berkbilger +berkowitz +bernard +bernardez +bernet +berry +berryman +bertaina +bertram +berube +besemer +bessire +best +betta +betts +beumer +beunder +bever +beverlin +bewly +beyer +bialeschki +bibles +biehle +biele +bigelow +bighi +bigliardi +bijlsma +bikki +billings +binegar +bingham +bini +binnenmarsch +birch +birdmore +birtley +bishop +bisson +black +blackburn +blackwell +blair +blake +blanchard +bland +blankemeier +blankenship +blase +blattner +bledsoe +blevins +blewett +blitch +blocher +block +bloom +blouard +blyth +bockius +bodrov +bogard +bogenrieder +boggs +bolin +bollinger +bolmer +bolyard +boman +bond +bonds +bone +booker +boon +boone +booth +bopp +border +boren +borstadt +boshoff +bosik +bosler +bossert +bostic +bostick +boswell +bosworth +bottom +botts +boucher +boulay +bouldin +boulet +boulware +bourgeois +bowen +bowers +bowman +boyd +boyer +boykin +boylan +boyle +boyt +bozzi +braams +bradbury +bradford +bradley +bradshaw +brady +brainerd +brajkine +braley +brammer +branch +brand +brandau +brandt +brannenburg +brannock +brannon +branson +brants +braswell +braughton +braun +braungart +bray +brazie +breaum +breeuwer +brehler +breningstall +brennan +bressi +bretanus +brewer +brewster +bridges +briggs +brinkman +brinson +britt +brittain +brock +brockman +brockschmidt +bronson +brooks +broome +brosius +brouillette +brown +browning +brubacker +brubaker +bruce +brueckner +brueggemann +bruehl +bruggeman +brumley +brundage +brundick +brunn +bruntz +brust +bryan +bryant +bryce +bryers +bryse +buch +buchanan +buckley +buckner +bucsis +budbill +budd +buechting +buehler +buehner +buetner +buettner +buffington +buford +buhler +buhs +bulkeley +bullis +bullock +bumstead +bunch +bunn +bunner +bunse +burdon +burger +burgers +burgess +burke +burlew +burn +burnell +burnett +burney +burnham +burns +burress +burris +burroughs +burrow +burt +burton +busch +buschmann +busekrug +bush +bushyhead +busker +buso +bustillogadea +butcher +butler +bybee +byfield +byington +byram +byrd +byrne +caceres +cadieux +cadrin +cain +cakall +calabrese +caldwell +cale +calhoun +callaham +callahan +calvert +calvin +camacho +cameron +camp +campbell +campos +canada +candido +candy +canfield +cann +cannan +cannings +cannon +cantrell +capet +caplinger +capps +carey +carleton +carls +carlson +carlsson +carlton +carmichael +carnahan +carnel +carney +carpenter +carr +carrillo +carrington +carroll +carrère +carse +carson +carter +carver +carwile +casey +caskinette +casper +cassady +cassell +castillo +castillon +castles +castro +catanese +catton +caulley +cavanaugh +cernelli +cernos +cervera +chamberlin +chambers +champion +chan +chancellor +chandler +chaney +chang +channel +chapey +chapin +chaplauke +chapman +chappel +charles +charlton +chas +chase +chastain +chasteen +chatham +chauvin +chavez +checksfield +chen +cheney +chenoweth +cherrie +cherry +chesshyre +childers +childs +chinglee +chipman +chisholm +chislett +chism +chitwood +chizhov +chmelyk +christensen +christian +christie +christou +chuchalin +chupek +church +ciaffa +ciani +cipolla +clapp +clark +clarke +clarkson +clay +clayton +cleijne +clemens +clement +clements +clentine +clermont +cleveland +clift +cline +cloutier +cnossen +coale +coates +cobb +cochon +cochran +cocke +cockrell +coddington +cody +coe +cofer +coffman +cohen +coker +cole +colegrove +coleman +collier +collins +colon +colvin +combs +compton +comstock +conay +conda +conely +conger +conklin +conlee +conley +connally +conner +connor +conrad +conrades +constant +conti +contreras +converse +conway +coody +cook +cooke +cooley +coon +coonley +coons +coontz +cooper +copeland +corbet +corbin +cordery +cordes +cordon +cordry +cormier +cornish +cornwell +correll +corson +cortez +corwin +cosgrave +costello +couch +couillard +coulombe +coulter +counsell +courteau +couture +covington +cowan +cowell +cowgill +cowper +cowser +cox +coy +crabtree +crafton +craig +cramer +crane +cranston +crawford +creecy +crenshaw +crichton +cripps +critcher +croan +croft +croitor +cronin +crosher +cross +crossley +crouch +crow +crowder +crowell +croy +crump +cruse +crutchfield +cruz +cuba +cue +culberson +culp +cummings +cummins +cunningham +curby +curdts +curran +curren +current +currie +curry +curtis +cutting +cvahte +cyr +daab +daber +dafler +dagan +daggett +dalbey +dale +dalton +daly +damani +damron +daniel +daniels +danneman +danner +dar +darlington +darr +daughtery +davenport +davey +david +davidson +davies +davis +dawson +day +dean +dearing +dearman +debenthal +decker +dedrick +degg +degonia +deibert +delaney +delen +deleon +delgado +dell +dellenbach +dement +demont +denbo +denell +dennis +denson +denton +deringer +derksen +derrick +deschenes +desportes +desquiens +desroches +detwiler +deuschle +deutschmann +diamond +diaz +dick +dickerson +dickinson +dickson +diefendorf +diehl +diehn +dierig +dierker +dierkes +dierks +dietrich +dillingham +dimmerling +dippel +dirksen +dittmar +dixon +dmitriy +dobing +dobson +dockery +dodd +dodson +doering +doherty +doidge +dollar +domansky +domark +domingo +domingos +dominguez +donnelly +donoghue +doren +dorschel +dorsey +dossett +dostal +doud +dougherty +doughty +douglas +doutille +doutrich +dowdy +down +downey +downing +doyle +drake +drane +drath +dray +dreher +dressel +drexel +driscoll +droberg +drosbach +drouin +drum +drummonds +dryer +drysdale +duplessis +duane +duarte +dubbs +dube +dubois +dubowski +dubuque +duckworth +dudley +due +dueno +dueuer +duke +dulany +dumond +duncan +dunlap +dunn +dunnam +dunning +dupont +duquet +duran +durham +durkin +dustin +duval +dwyer +dyer +dyett +dykes +dyson +eaby +ealem +east +eaton +ebert +ecker +eckert +eckles +eckman +eddy +eden +edgar +edge +edgerton +edinger +edmunds +edsall +edwards +eerdmans +egan +egberinl +eglajs +ehlers +ehnert +eiple +eiten +eke +eklund +elders +eldridge +elgood +ellard +elliot +elliott +ellis +ellison +ellmaker +ellzey +elm +elmore +elsner +elson +emberton +emerson +emory +emrich +endicott +engel +england +englert +english +ennor +enterich +entwisle +epshtein +erasmus +erickson +eriksen +eriksson +erker +erkstam +ernsberger +eshelman +eshleman +espey +espinosa +espinoza +estes +estrada +etchberger +etienne +etting +eubanks +eudy +eure +evans +evatt +everett +ewing +factor +faes +fair +fairbanks +fairley +fairman +fantus +farmen +farmer +farrales +farrell +farris +farrow +farrugia +farwell +fassnacht +faulkner +faust +fears +feldman +fell +fender +fenn +fennessy +fenstermacher +fenton +fenwick +ferguson +fernandez +ferreccio +fetterly +fewell +feyl +fiat +fidler +field +fields +figueroa +filippoff +fillman +finken +finley +firth +fischer +fisher +fister +fitzgerald +fitzmaurice +fitzwater +flack +flamm +flanders +fleming +fletcher +flickinger +flores +flowers +floyd +flugge +fluharty +fly +flying +flynn +focke +foh +foley +follett +fontaine +foote +forbes +ford +fordyce +foreman +forget +fornwalt +forticq +fortin +foster +fothergill +fouda +fournier +foushee +foutain +fowler +fox +fradet +frady +france +franchi +francis +frank +franklin +franky +frantz +frazier +frederic +frederitzi +freedman +freeman +fremsdorf +french +frese +frew +frey +freytes +frias +frick +friddle +friedlander +friesen +fritz +frost +fry +frye +fugitt +fuhrman +full +fuller +fullhart +funda +fung +funk +furnace +gacusana +gadd +gagnon +gainer +gaines +galasso +galbraith +gallagher +gallaher +gallegos +galloway +galluser +gamache +gambon +gammon +gan +gangloff +gann +gant +garber +garcia +gardiner +gardner +garg +garman +garmin +garner +garrett +garrison +gartner +garza +gates +gatheridge +gatlin +gatling +gattain +gattling +gaudreau +gaudry +gausepont +gautier +gearhart +gebel +gechter +gedeon +geders +gee +geelan +geertsma +geffe +geigel +geiman +gemert +gemp +gentry +george +gerahty +gerard +gerke +gerlt +giasson +gibble +gibbs +gibler +gibson +giddings +giesinger +giffen +gifford +giguere +gilbert +gilbertson +giles +gill +gilleland +gillespie +gillette +gillock +gilmore +gilmour +ginger +gingras +giorgio +girard +girgenson +glascock +glaser +glass +glasscock +gleason +gleba +gleeson +glenn +glover +gockley +godown +goeller +goff +goforth +goh +gold +goldberg +golden +goldman +goldsmith +gomez +gonschorek +gonzales +gonzalez +goodline +goodman +goodson +goodwin +gorden +gordon +gorecki +gorham +gose +goshen +goss +gossage +gosselin +goutarias +gower +goza +graham +gralicke +grant +grappone +grass +graves +gray +graziani +greathouse +green +greene +greenhow +greening +greenlee +greeno +greer +gregg +gregory +grenier +gretton +grffiths +griffin +griffith +griffiths +grimes +grimley +grimm +grimmett +grindel +griswold +groetling +groh +gromit +gross +grossi +grosvenor +ground +grover +groves +grube +guerra +guerrero +guest +guhse +guinn +guisfredi +gulager +gullie +gunia +gunter +gunther +gupta +gurdian +gurlin +gushee +gustafsson +gustins +guthrie +guthy +gutierrez +guyon +guzman +gyula +gürbüz +haakonvoldum +haas +haase +hacher +haché +hackman +haddix +haeffner +haefner +hafer +haffner +hafner +hagan +hagerty +hagström +haguenauer +hahn +hain +haines +hair +hairston +hale +haley +hall +hallam +haller +hallet +halloway +hallum +halm +halmshaw +halpert +halsell +halverson +hamby +hamel +hamilton +hamm +hammett +hammond +hampel +hample +hampton +hancock +haneklau +hanel +hankins +hann +hannan +hansch +hansen +hanson +harbert +hardaway +harden +harder +hardin +harding +hardt +hardy +harel +harger +harlan +harle +harmon +harned +harnwell +harper +harrell +harrington +harris +harrison +harrity +harrod +harry +hart +harting +hartkopp +hartman +hartweck +hartzler +harvatin +harvey +hasenau +hasse +hastings +hatch +hatcher +hatchett +hatfield +hathaway +hauck +haughton +hauser +haverstick +hawes +hawkins +hawley +hayes +haynes +haynie +hays +hazel +hazeltine +healey +heard +heath +heathcock +heather +hebert +hecke +hedden +heege +hegel +heide +heikurinen +heil +hein +heinen +hejna +held +helen +helphrey +hembruock +henderson +hendrick +hendricks +hendrix +hennion +hennler +henrico +henry +hensgens +hensler +hensley +henson +heppe +herbein +herbert +herman +hermann +hernandez +herr +herrell +herren +herrera +herriage +herrick +herring +herweck +hess +hesselt +hester +hetz +hetzel +heuckelbach +hewitt +heyer +heyward +hezel +hickey +hickman +hicks +higbee +higdon +higginbotham +higgins +highley +hight +hill +hillenbrand +hils +hilton +hinch +hinckly +hines +hinkle +hinsey +hinsley +hinton +hippenmeyer +hissong +hixon +hixson +hoag +hobbs +hoch +hodge +hodges +hoebing +hoeflinger +hoehns +hoell +hoemann +hof +hofer +hoffman +hoflack +hogan +hohensee +hohmann +hoke +holburt +holcomb +holder +holgate +holifield +hollabaugh +holland +holleman +holley +hollingdale +holloway +hollowell +holmes +holstein +holstine +holt +holtheuer +holzum +homan +homanberg +hong +hood +hook +hooper +hoopes +hoosang +hoover +hopkins +hopper +horachek +horan +hord +horesteille +horn +horney +horning +hornung +horton +hosenfeld +hoskins +hostetter +hostler +hotsinpiller +houde +houghton +houlne +hounsell +house +houser +houston +hovin +hovlandsdal +howard +howe +howell +howes +howland +howlett +hoyt +hsieh +huard +hubbard +hubert +huckaby +huckins +huddleston +hudgens +hudson +huey +huff +huffman +hughes +hulet +hull +humble +humphrey +hundley +hunecke +hunt +hunter +huntley +hurrell +hurshman +hurst +hursán +hurt +huss +hustead +hutchings +hutchins +hutchinson +hyatt +hyland +hylton +håkansson +ibach +icaza +iceberg +idsinga +iiskola +iler +iliev +imfield +imig +imperiale +ingalls +ingle +ingram +ireland +irgens +irons +irous +irwan +isburg +ison +ivanytsch +ivey +ivins +ivy +ivzenkovic +izenstein +izycki +jackson +jacobs +jacobsen +jacques +jager +james +janes +jansen +janssen +janssens +jaynes +jefferson +jeffries +jehoel +jelicks +jenings +jenkins +jenkinson +jennings +jensen +jerome +jesse +jessett +jewett +jezusco +jiechao +jiglund +jimenez +jockish +joenwai +john +johns +johnson +johnston +jolicoeur +jolly +jones +jonke +jordan +joseph +joyce +juarez +jubb +jump +jung +junnila +järvi +kabler +kahle +kaletta +kalniòo +kane +kantola +kantor +kapke +kappelman +kar +karchev +karesh +karleskint +karlsson +kartaslammi +kaspar +kattleman +katz +kaub +kauffman +kay +kazin +keating +keaton +keck +keddem +keefe +keeler +keeley +keen +keene +keith +kell +keller +kelley +kelly +kemp +kendall +kennedy +kennel +kennerly +kent +kepel +kerdijk +kerr +kesl +ketter +kettle +kettner +key +keys +keyser +kibbey +kickert +kidwai +kiefer +kiers +kight +kile +kilgour +kilheffer +kilheffner +killingsworth +killion +kim +kimball +kimble +kinder +kindle +kines +king +kinney +kinser +kinsey +kinslow +kirby +kirk +kirkpatrick +kirwan +kitchin +kittrell +kivimäki +klass +klein +kleine +klimpl +klopp +knapp +knight +knippenberg +knoblauch +knotts +knous +knowles +knowlton +knox +koch +kochevar +kodelja +koebel +koeller +koendering +koerner +koetsier +kohne +kohr +kokwai +kolar +kolb +koller +konarski +koon +kooyman +kopff +kopp +korber +korp +kosloff +kotter +kourik +kraemer +kramer +kras +kratke +kraus +krause +krebs +krecker +kreider +kretzin +krick +krishnan +kromer +kronk +krumman +kruse +kuchnoel +kuhn +kuhnell +kummer +kunze +kuresko +kurtz +kushwaha +kusmin +kuttner +labarre +lapoint +lataille +labay +labreque +lacey +lacy +lafferty +laidlow +lail +lair +lajoie +lamar +lamb +lambert +lamerand +lancaster +landis +landrum +landry +landy +lane +lang +langer +langlois +langston +laning +lankford +lankshear +lanmaster +lanner +lantrip +lapouchnian +lara +larcom +lard +larkins +larouche +larsen +larson +larsén +last +lathrop +latimbre +lau +laughlin +lauzon +lavoy +lawhead +lawler +lawrence +lawson +lazar +leach +lear +leblanc +ledenmark +lee +leekeirl +leech +leeper +lefler +leger +lehman +lehtovaara +leib +leitao +leitch +lemke +lemons +lengyel +lenhart +lennox +lentini +leon +leonard +leong +lester +letarte +letendre +lett +levesque +lewallen +lewis +libis +licata +lifson +light +lightstone +lilgert +lima +limetsch +linares +lindquist +lindsay +lindsey +lindwedel +linek +lines +linge +linker +linkogel +linson +linus +lipe +lipps +list +little +litzsinger +liu +livingood +livingston +lizot +llanos +lloyd +lochridge +lockhart +loenders +logan +lograsso +lohr +lombard +lombardi +london +long +longenecker +longnecker +loomis +looney +loose +lopez +lord +lorenzo +loring +lorton +lough +loughrie +louhr +lound +love +lovejoy +lovell +lowe +lowell +lowery +lownes +loye +lucas +luce +lucius +lucko +ludwick +ludwig +luissalcines +lulic +luna +lund +lundberg +lura +luthe +luther +lutz +lux +luzadder +lyle +lynch +lynn +lyon +lyons +mabe +mabson +maccuuladh +macdonald +macgillivray +mackellar +mackenzie +macpherson +macedo +macey +machin +mack +mackey +macomber +madore +maender +magalhaes +maheu +maho +mahoney +majakari +major +malcom +maldonado +malicoat +malin +mallet +mallett +mallory +malone +malos +malzone +mamone +manaev +mandel +mandula +mann +manning +mansfield +manson +mantione +manuel +marabotto +marbach +marbourgh +march +marchant +marie +markovic +marks +marler +marple +marquez +marquis +marr +marriott +marsden +marsh +marshall +martin +martinez +marting +marttila +mary +mason +massey +mast +masters +mastrantuono +matheson +mathews +mathias +mathis +matthews +matthias +mattingly +mattli +mauger +maulana +maule +maus +mawdsley +maxey +maxson +maxwell +may +mayandon +mayberry +mayes +mayhew +maynard +mayo +mayow +mays +mazza +mcalexander +mcalister +mcallister +mcaree +mcarthur +mcbride +mccafferty +mccall +mccallister +mccarra +mccarthy +mccauley +mcclain +mcclellan +mccleskey +mccloud +mcclung +mcclure +mccollum +mcconnell +mccormick +mccowan +mccoy +mccracken +mccullough +mccumiskey +mccurdy +mcdaniel +mcdaniels +mcdermott +mcdonal +mcdonald +mcdonnell +mcdonough +mcdormand +mcdowell +mceachern +mcelroy +mcelveen +mcfarland +mcgee +mcgraw +mcgrew +mcguire +mcilveen +mcintosh +mcintyre +mckean +mckee +mckeever +mckenstrie +mckenzie +mckinney +mckinstrie +mclafferty +mclaggan +mclain +mclaughlin +mclean +mcleod +mcmahon +mcmanus +mcmclain +mcmillan +mcmurtrie +mcnair +mcnamara +mcpherson +mcquarrie +mcqueen +mcrae +mcspadden +mcswain +mcvicker +mcwilliams +meaden +means +meddemmen +medina +medler +medley +medlin +meech +meek +meeks +megginson +meier +meiners +meinhart +mejia +melber +mellinger +melton +melvin +mendenhall +mendez +mendoza +mercado +mercer +mercier +mercille +meredith +merkel +merkle +mermann +merriman +merritt +mesman +messier +metz +metzger +meyer +meyers +michalowski +middleton +miethe +mikhailovsky +mikilas +miklos +milam +miles +miller +millett +mills +milne +milner +milton +minchin +miner +minnich +minshall +minster +minville +miranda +mironin +misik +miskerik +mistry +mitchelhill +mitchell +mitchelmore +miville +moale +moats +mock +moehlenhoff +moehlenkamp +moeller +moenkhoff +mohler +mohow +molina +moller +monfort +monroe +monsees +monsona +montagna +montague +montes +montgomery +montoya +moody +moon +mooney +moore +moose +morales +moran +morehead +moreno +morgan +morin +morowitz +morphett +morrice +morris +morrison +morrow +morse +mortensen +morton +moschner +moseley +moses +mosley +moss +mosser +mouser +moushey +moxley +moyer +moyle +moyles +moynahan +mraz +mros +mudd +mueller +mukhtar +mulholland +muller +mullinix +mullins +munday +mundy +munoz +munro +munson +muntz +murdock +murphy +murr +murray +muse +musgrove +musil +mussbach +musselman +muszer +mutel +myers +naes +nagashima +nagle +nahm +nalazek +nanney +narayan +narciso +nash +nason +naumann +navarro +nave +neal +neale +nebdal +neece +neel +neff +neilson +nellen +nelson +nemmo +nester +nestor +newlon +newman +newsham +newton +nguyen +nichols +nicholson +nicodei +nicoll +niemeyer +nies +nixon +noble +nolan +nord +norman +norris +norton +norwell +norwood +noud +novaes +novak +nuchter +nunes +nunez +nuttall +nuzum +nyulassy +o'brien +o'connell +o'conner +o'grady +o'hara +o'leary +o'malley +o'meara +o'neil +ober +oberbeck +oberholser +oberholtzer +oberholzer +oberosler +obrecht +obrien +oconnor +octeau +oehrke +ogden +oge +oger +ogier +ogle +oh +ohlinger +ohlsen +olesen +oleynik +olive +oliveira +oliver +ollive +olsen +olson +omond +oneal +opeloyer +opeloyeru +ora +orlando +orosz +orr +ortega +ortiz +osage +osborn +osborne +osgood +ossenfort +osula +ott +otterstad +ottman +otto +ouellet +ouellette +overholser +overstreet +owen +owens +owsley +pace +pacheco +pack +padilla +paganto +page +painter +pala +palmer +paluzga +panda +paolo +paquette +paquin +pardue +pardy +park +parke +parker +parkhill +parks +parr +parrinello +parrish +parsons +paschke +pastori +pastrick +patel +patrick +patterson +patton +paul +paulet +pauley +paulsen +pauly +paumelle +pavlin +pavlock +paxson +payne +peak +pearah +pearce +pearson +peck +peddlesden +peden +pedersen +pedigo +pelky +pelles +pena +pence +pendleton +pengry +penka +penley +penn +pennell +pennington +penrose +pentelbury +peoples +pepper +perera +perez +perkins +perotti +perren +perrin +perriseau +perry +person +persson +peterman +peters +petersen +peterson +petri +petrig +petrounakou +pettigrew +pettit +pettus +peyrot +peyton +pfaff +pfitzenger +phelps +phillips +phipps +piastra +pickard +pickett +pickle +pierce +pilger +pilkington +pilkinton +pinckley +pinkel +pinzer +pirnar +pirtle +pit +pittman +pitts +placzkavich +plante +player +pleis +pletcher +ploesser +ploog +plumb +plummer +pocock +pogrelis +politte +pollock +poole +poos +pope +poppe +portell +porter +porto +post +potten +potter +potts +poulet +pound +powell +powers +prather +pratt +prebit +preisendorf +prence +presley +preston +prevost +price +priester +prince +proctor +proffitt +prospero +proudfoot +pruitt +przybyl +puckett +pugh +pulliam +pullins +pullman +purdy +purvis +putnam +putney +putt +quattlebaum +queen +quell +quella +quelle +quick +quigley +quince +quinn +quintelier +quinton +quisenberry +raburn +racine +rader +radley +raffo +ragsdale +rahm +rahn +raine +raines +rains +rainwater +rakar +ralston +ramirez +ramos +ramsberg +ramsey +randall +randolph +raney +rangan +rangefelt +rash +rasmussen +rason +ratcliff +rate +rathfon +rathman +ratje +ratner +raupp +ravenscraft +rawls +ray +raygor +raymond +rea +reagan +rebman +redd +reece +reed +reese +reeser +reeves +regan +regester +regot +reich +reicter +reid +reilly +reinholz +reinke +reiser +reiter +reitz +rekart +rekutin +renfro +renfrow +reno +rentchler +resch +retherford +rexdale +reyes +reynold +reynolds +rhatigan +rhoades +rhodelander +rhodes +ribeiro +riccio +rice +rich +richard +richards +richardson +richmond +richter +richwine +ricketts +riddick +rider +ridgeway +ridout +riebold +riese +rigdon +riggs +righi +riley +rinback +rines +ringen +ringler +rinner +rios +ritchey +ritchie +riton +rittenhouse +ritter +rivas +rivera +rivers +robb +robbins +roberson +roberts +robertson +robins +robinson +robison +robles +robson +rodgers +rodriguez +rodriquez +roe +roebrant +roebuck +roesch +roess +roessler +rogai +roger +rogers +rojas +rolen +rolfe +rollings +rollins +roman +romand +romero +romig +romkes +rondel +root +roper +ropp +roques +rosa +rosati +rose +rosemann +rosenthal +rosier +ross +roth +rothgeb +rott +rottler +roudebush +roundtree +rountree +rowden +rowe +rowland +rowlandson +roy +rudolph +ruess +ruggles +ruhl +ruiz +rullan +rumbaugh +rundle +runfola +rupiper +ruppel +rush +russell +russo +ruth +rutherfoord +rutzel +ryan +rynders +rypstra +röther +sackwell +saffel +saffle +saffold +safuan +sahlstrom +sajid +salazar +salinas +salles +salmon +salsbury +samson +sanchez +sander +sanders +sandoval +sanford +sanfrod +saniter +santiago +santoni +santos +sapp +sappington +sarel +sargent +sas +satterfield +sauder +saunders +savage +savic +saville +savoie +sawyer +saye +sayre +scales +schaeffer +schaffnitt +schamberger +schanze +schasteen +schaumberger +schenk +schilders +schipper +schirmer +schlegel +schlitzer +schlobohm +schmeis +schmid +schmidt +schmitt +schmitz +schmuck +schneider +schoenberger +schofield +scholfield +schommer +schooley +schoonover +schopp +schowengerdt +schrack +schrader +schreiber +schreiner +schrick +schrier +schrimpf +schrimpshire +schrimscher +schrimsher +schrimshire +schroeder +schrupple +schubert +schuchman +schuit +schulte +schultz +schumacher +schumaker +schuman +schumann +schutte +schwab +schwartz +schwartzkopf +schweer +schweikert +schweiss +schwenderman +sciurba +scofield +scott +scrimpshire +scrimsher +scrimshire +scroggins +seal +seaman +sears +sebren +sebring +sedgwick +seely +seguinverner +seipel +seith +selby +self +selivanov +sellen +sellers +senff +sensenig +serrano +setiadji +settergren +sever +seward +sexton +shackles +shaffer +shailes +shands +shank +shannon +shapely +shapiro +sharp +sharples +shasserre +shaw +sheahan +sheets +shelton +shenefelt +shepard +shepherd +sheppard +shepperd +sherman +sherrill +sherry +sherwood +shewmaker +shieh +shields +shilnikov +shim +shimek +shingleton +shipley +shipman +shirk +shober +shoemaker +short +shorter +shriver +shull +shurley +sibley +sickles +siebers +siechrist +siegrist +siemann +sigman +silberman +silberstein +silva +silverman +silvernagel +simenic +simko +simmons +simms +simoes +simon +simons +simpson +sims +singletary +singleton +sirigos +sisk +siu +sizer +sjostrom +skaggard +skaggs +skiles +skillman +skinner +slagle +slark +slater +slaughter +slierendrecht +sloan +sloper +slouber +small +smead +smedley +smeets +smith +smits +smoak +smolar +snow +snowden +snyder +solimano +solis +solomon +sommerkamp +somphan +sorenson +soto +soucy +soulman +sousa +southerland +southern +sowers +spaeti +spahn +spalding +spangler +sparks +speaker +spears +specht +spector +speidel +spencer +spirek +spires +spoel +spoon +spoth +srock +staebler +stafford +stahl +staley +stam +stambaugh +stamm +standiford +stanley +stansberry +staples +starensier +stark +starnes +stasulat +stauffer +stedman +steele +steely +stefanelli +stein +steinemann +stendahl +stephens +stephenson +sterling +stevens +stevenson +steward +stewart +stice +still +stine +stinton +stirk +stock +stockton +stokes +stoll +stoltz +stone +stones +storey +storm +stout +stoyell +strader +straher +strang +strauss +streets +streing +strickland +stroetinga +strohm +strong +strozewski +strum +stuart +sturdivant +sturgess +sturgis +stutzman +suarez +sublett +suddath +suggs +sullins +sullivan +summerfield +summers +summey +summy +sunderman +sunderwirth +sundgren +supawanich +sutcliffe +sutherland +sutton +svedin +svendsen +svensson +swaim +swaine +swally +swanson +swartz +swasey +sweeney +sweet +swenson +swift +swisher +sypher +tackes +taliaferro +talipsky +tamietti +tan +tang +tank +tanner +tapp +tappert +tardif +tate +tauschek +taylor +teem +teeter +teets +temple +templeton +templin +tenny +teppen +terrill +terry +tesche +tesi +tessier +tetrick +tharp +thatcher +thibault +thibaut +thibodeau +thierer +thies +thill +thomas +thomerson +thompson +thomson +thorn +thornhill +thornton +thorup +thrower +thursfield +thys +tidwell +tierney +tilley +tillman +timberlake +timchenko +timm +timmons +tinker +todd +tol +tolbert +tomlinson +toomer +toothaker +topping +torrence +torres +touchstone +toupin +townend +townsend +tracy +tran +traudt +traugott +trautmann +traxler +trego +trent +trethewey +trevino +triggs +triplett +trone +trout +troutman +troutt +trovato +troxler +truesdale +truetzel +trujillo +trump +tschikowsky +tshudy +tuck +tucker +tukker +turberville +turner +turrentine +turén +tuttle +tweed +twiford +tyler +tyson +ulich +uliel +underwood +upton +utt +valverde +valdez +valentine +vance +vanik +vann +varga +vargas +varner +vartiainen +varvel +vasquez +vaughan +vaughn +vaught +vawter +vazquez +veenvliet +vega +vehlewald +velasquez +velez +velonis +vendt +venters +ventres +ventress +vergason +vernon +vigar +vigle +villalobos +villarreal +vincent +vinner +virga +virkelyst +vitali +vitro +viverett +vogel +vogelgesang +voldi +von pilkington +voss +vuille +vunovich +wack +wade +wager +waggoner +wagner +wagstaff +wakefield +walker +wall +wallace +waller +wallis +walls +walmsley +walsh +walter +walters +waltman +walton +wang +ward +warden +ware +wark +warner +warren +warwick +washington +wass +waterham +waterkotte +waterman +waters +watkins +watson +watts +weaver +webb +webber +weber +weble +webster +weekley +weeks +wegener +weikert +weiler +weimer +weiner +weismuller +weiss +weitzel +welby +welch +wellons +wells +welsh +wenger +wentland +werhner +werner +wesley +wesolowski +wessel +wessels +west +weston +westphal +westwood +wetzel +whaples +wheat +wheeler +whelan +wherley +whitaker +white +whitehead +whitford +whiting +whitman +whitney +whitsett +whitsitt +whitson +whitwam +whitworth +wickenhauser +wickliffe +wicks +wideman +wiegand +wiegratz +wiggins +wiklund +wilcox +wilcoxon +wilder +wildermuth +wiley +wilkerson +wilkin +wilkins +wilkinson +will +willcut +willey +william +williams +williamson +willis +willmes +willoughby +willowspond +wills +wilmoth +wilson +winfrey +wingard +wingate +wingenfeld +wink +winn +winslow +winston +winter +wintermute +winters +wintle +winton +wischmeyer +wisdom +wise +wiseman +wissman +withers +witmer +witt +witte +woelk +wofford +wognum +wolf +wolfe +wolkey +wolters +wolz +womack +wong +wood +woodard +woodbury +wooding +woodring +woods +woodson +woodward +woolery +woolf +wooten +wordsworth +worman +worrall +worrell +worrilow +wosnuk +wrage +wren +wright +wustenhagen +wyatt +wyttenbach +yahn +yancey +yap +yarnall +yates +yeager +yeomans +yerger +yoch +yogho +york +young +younglove +yount +yoxall +zaegel +zaitsev +zarnits +zbaren +zeller +zeni +zimmerman +zinselmeier +zondler +zorzano +zumwalt +zwicker diff --git a/RGens/data/sample-grammars/martial-arts.gram b/RGens/data/sample-grammars/martial-arts.gram index ac22306..7907e02 100755 --- a/RGens/data/sample-grammars/martial-arts.gram +++ b/RGens/data/sample-grammars/martial-arts.gram @@ -1,9 +1,9 @@ -[art-name] [art-1] [art-2] +[martial-arts-name] [art-1] [art-2] [art-1] [art-3] [art-2] [art-3] [art-1] [art-2] [art-3] -pragma initial-rule [art-name] +pragma initial-rule [martial-arts-name] [art-1] running hungry diff --git a/RGens/data/sample-grammars/mission.gram b/RGens/data/sample-grammars/mission.gram index 9dce28a..7954657 100644 --- a/RGens/data/sample-grammars/mission.gram +++ b/RGens/data/sample-grammars/mission.gram @@ -28,11 +28,13 @@ pragma initial-rule [mission-statement] [noun-part] our [adjective] [noun] our [noun] - our [noun-prefix] [noun] - [adjective] [noun-prefix] [noun] + our [[noun+noun-prefix]] + [adjective] [[noun+noun-prefix]] [adjective] [noun] [noun] +[noun+noun-prefix] [noun-prefix] [noun] + [opening] it's our [duty] to it is our [duty] to it is our [mission] to diff --git a/RGens/data/sample-grammars/pokeattacks.gram b/RGens/data/sample-grammars/pokeattacks.gram index 7f943ba..b667cc7 100755 --- a/RGens/data/sample-grammars/pokeattacks.gram +++ b/RGens/data/sample-grammars/pokeattacks.gram @@ -1,15 +1,12 @@ -[attack] [word-1] [word-1] +[pokeattack] [word-1] [word-1] [word-2] [word-2] [word-1] [word-2] [word-2] [word-1] -pragma initial-rule [attack] +pragma initial-rule [pokeattack] -pragma prefix-with [attack] [word-1] -# pragma prefix-with [attack] [word-2] - -# pragma suffix-with [attack] [word-1] -pragma suffix-with [attack] [word-2] +pragma prefix-with [pokeattack] [word-1] +pragma suffix-with [pokeattack] [word-2] [word-1] acid aerial diff --git a/RGens/data/sample-grammars/realcity.long b/RGens/data/sample-grammars/realcity.long new file mode 100644 index 0000000..1c11607 --- /dev/null +++ b/RGens/data/sample-grammars/realcity.long @@ -0,0 +1,76 @@ +Birmingham +Anchorage +Mesa +Phoenix +Tucson +Anaheim +Fresno +Long Beach +Los Angeles +Oakland +Riverside +Sacramento +San Diego +San Francisco +San Jose +Santa Ana +Stockton +Aurora +Colorado Springs +Denver +Washington +Jacksonville +Miami +St. Petersburg +Tampa +Atlanta +Honolulu +Chicago +Indianapolis +Wichita +Lexington +Louisville +Baton Rouge +New Orleans +Baltimore +Boston +Detroit +Minneapolis +St. Paul +Kansas City +St. Louis +Omaha +Las Vegas +Jersey City +Newark +Albuquerque +Buffalo +New York +Rochester +Charlotte +Raleigh +Akron +Cincinnati +Cleveland +Columbus +Toledo +Oklahoma City +Tulsa +Portland +Philadelphia +Pittsburgh +Memphis +Nashville +Arlington +Austin +Corpus Christi +Dallas +El Paso +Fort Worth +Houston +San Antonio +Norfolk +Richmond +Virginia Beach +Seattle +Milwaukee diff --git a/RGens/data/sample-grammars/realcompany.long b/RGens/data/sample-grammars/realcompany.long new file mode 100644 index 0000000..4f924df --- /dev/null +++ b/RGens/data/sample-grammars/realcompany.long @@ -0,0 +1,207 @@ +3Com +AFLAC +AT&T +Ace Hardware +Aetna +Aid Association for Lutherans +Albertson's +Allstate +Alltel +AmerenUE +America Online +American Express +American General +Ames Department Stores +Anheuser-Busch +Apple Computer +Archer Daniels Midland +AutoZone +Avis Rent A Car +Avon Products +B.F. Goodrich +Bank of America Corp. +Barnes & Noble +Bell Atlantic +BellSouth +Berkshire Hathaway +Best Buy +Black & Decker +Boeing +Bristol-Myers Squibb +Burlington Northern Santa Fe +CBS +CVS +Cablevision Systems +Campbell Soup +Caterpillar +Cendant +Charles Schwab +Chase Manhattan Corp. +Chevron +Cigna +Cinergy +Circuit City Group +Cisco Systems +Citigroup +Clorox +Coastal +Coca-Cola +Colgate-Palmolive +Columbia/HCA Healthcare +Comcast +Comerica +CompUSA +Compaq Computer +Computer Associates Intl. +ConAgra +Conoco +Conseco +Continental Airlines +Corning +Costco Wholesale +Dana +Dell Computer +Delta Air Lines +Dillard's +Dole Food +Dollar General +Dow Chemical +Eastman Kodak +Eli Lilly +Este Lauder +Exxon Mobil +Fannie Mae +Farmland Industries +FedEx +Firstar Corp. +Fleetwood Enterprises +Ford Motor +GTE +Gannett +Gap +Gateway +General Electric +General Mills +General Motors +Gillette +Goldman Sachs Group +Goodyear Tire & Rubber +H.J. Heinz +Hartford Financial Services +Hasbro +Healthsouth +Hershey Foods +Hewlett-Packard +Home Depot +Honeywell International +Hormel Foods +ITT Industries +Ikon Office Solutions +Ingersoll-Rand +Intel +IBM +J.C. Penney +J.P. Morgan & Co. +John Hancock Financial Services +Johnson & Johnson +Kellogg +Kimberly-Clark +Kmart +Knight-Ridder +Kroger +Lexmark International +Lockheed Martin +Lowe's +Lucent Technologies +MCI WorldCom +Marriott International +Mattel +Maytag +McDonald's +McGraw-Hill +Merck +Merrill Lynch +Metropolitan Life Insurance +Micron Technology +Microsoft +Monsanto +Morgan Stanley Dean Witter +Motorola +Mutual of Omaha Insurance +NCR +Nabisco Group Holdings +New York Life Insurance +New York Times +Newell Rubbermaid +Nextel Communications +Nike +Nordstrom +Northwest Airlines +Office Depot +OfficeMax +Oracle +Owens Corning +Paine Webber Group +PepsiCo +Pfizer +Pharmacia & Upjohn +Philip Morris +Procter & Gamble +Providian Financial +Prudential Ins. Co. of America +Quaker Oats +Qualcomm +Quantum +Qwest Communications +R. J. Reynolds Tobacco +Ralston Purina +Raytheon +Rockwell International +SBC Communications +Safeway +Saks +Sara Lee +Seagate Technology +Sears Roebuck +ServiceMaster +Sherwin-Williams +Shopko Stores +Sodexho Marriott Services +Southwest Airlines +Sprint +Staples +State Farm Insurance Cos. +Sun Microsystems +SunTrust Banks +Sunoco +Supervalu +Tandy +Target +Tenet Healthcare +Texaco +Texas Instruments +Time Warner +Times Mirror +Toys `R' Us +Trans World Airlines +Tyson Foods +U.S. Bancorp +US Airways Group +US West +Ultramar Diamond Shamrock +Union Carbide +Union Pacific +Unisys +United Parcel Service +UnitedHealth Group +Universal +Viacom +Wal-Mart Stores +Walgreen +Walt Disney +Warner-Lambert +Wells Fargo +Weyerhaeuser +Whirlpool +Winn-Dixie Stores +Xerox diff --git a/RGens/data/sample-grammars/superhero.gram b/RGens/data/sample-grammars/superhero.gram index c4f6e15..cec67d0 100755 --- a/RGens/data/sample-grammars/superhero.gram +++ b/RGens/data/sample-grammars/superhero.gram @@ -1,10 +1,10 @@ -[superhero] [first-part] [second-part] +[superhero-name] [first-part] [second-part] [second-part] [first-part] -pragma initial-rule [superhero] +pragma initial-rule [superhero-name] -pragma suffix-with [superhero] [third-part] -pragma suffix-with [superhero] [fourth-part] +pragma suffix-with [superhero-name] [third-part] +pragma suffix-with [superhero-name] [fourth-part] [first-part] Captain Yellow diff --git a/RGens/data/sample-grammars/syllable.long b/RGens/data/sample-grammars/syllable.long new file mode 100644 index 0000000..ee27d49 --- /dev/null +++ b/RGens/data/sample-grammars/syllable.long @@ -0,0 +1,530 @@ +ab +ack +ag +ad +al +an +ar +at +ash +as +augh +ay +au +ba +bab +bat +bal +ban +bar +bau +be +bee +bel +ben +ber +bes +bet +bil +bin +big +bir +bis +bla +black +blan +blat +bled +blo +bly +bock +bod +bol +bon +boo +bop +bor +bos +bot +bow +boy +bra +brad +bram +bran +bras +brau +bren +brew +bri +bro +brow +bru +brun +bry +buc +bud +bul +bur +burn +bus +bush +by +ca +cal +can +cant +car +carl +cap +cat +cer +cha +chan +chap +chas +che +chi +chis +chu +cla +clar +clay +cli +cler +coal +coat +cob +cod +col +com +con +coo +cop +cor +cow +cra +craw +cro +cub +cum +cun +cur +dab +dag +dal +dan +dar +day +dear +der +del +dem +den +der +des +dick +dir +dix +dil +dim +din +dis +dock +dod +dol +dom +don +dor +dos +doy +dow +dra +dre +dru +dry +dub +dud +duck +dul +dum +dun +dur +dwel +dye +eat +eck +ed +el +ell +elm +eng +ep +erk +er +esp +esh +fair +fan +far +fal +fam +fen +fel +fer +fid +fir +fin +flack +fla +flet +fly +fol +for +foo +fox +fran +free +fred +fre +fri +fry +fro +ful +fun +gal +gan +gar +gain +gat +gee +geer +gib +gil +gill +glas +gol +gold +good +gor +gos +gra +gree +green +gri +grif +gris +gro +gun +gush +gut +hack +hag +hal +hall +ham +hamp +han +har +hart +hat +haw +hear +heb +hel +hen +her +hes +hig +hick +hil +hip +hod +hol +hoo +hop +hor +how +hub +hud +hun +hur +ice +ick +ight +ill +imp +ir +is +it +jack +jam +jeff +jel +jen +jew +jer +jock +jon +jol +jum +kar +kan +kal +kay +keat +kee +kel +ken +ket +key +kil +kick +kin +kir +knight +kol +kor +kun +lab +lam +lan +lar +law +lee +len +let +lim +lime +lin +line +lip +lit +lock +lor +lom +loo +low +luck +lud +lun +mac +mab +mal +man +mar +mat +may +mea +med +mee +mel +meg +mer +mes +met +mid +mil +mis +mol +mon +mom +moo +mor +mot +mud +mum +mun +mur +mut +myer +nal +nan +nam +nag +nay +new +nel +nes +nick +nor +nov +ob +oct +og +ol +or +os +ot +ought +ow +pack +pal +par +pas +pat +pam +pan +pay +pea +pear +pel +pen +pep +per +pet +phe +phyl +phi +pick +pin +pit +pla +ple +plo +plor +pli +plu +pol +poo +pot +por +pow +pre +pro +pra +pru +put +pul +que +qui +quin +ra +rab +rad +ram +rat +ray +red +ree +ren +rick +rice +rid +ril +rin +rit +rob +roe +rom +ron +roo +ro +rot +ros +rud +rul +rut +sack +sal +san +sam +sap +sat +scha +schi +scho +schu +scri +sea +seb +sen +sel +sha +she +sher +shi +sho +sil +shu +sim +sla +sle +slo +sli +slu +sno +smee +smit +snow +sol +sout +sor +spa +spe +spi +spoo +spo +sta +stan +star +ster +stee +stin +sto +stre +stur +sun +sup +sul +sut +swa +swe +tan +tap +tar +tee +ter +tem +ten +tes +thor +ton +til +tim +too +tre +trip +tro +tut +tur +ul +un +ur +van +val +var +vee +ver +vin +vel +vir +wad +wal +war +wat +web +wel +wes +whit +wil +will +win +wit +woo +wood +wool +yan +yar +zar +zin diff --git a/RGens/data/sample-grammars/tarotcard.gram b/RGens/data/sample-grammars/tarotcard.gram index 9fd68a8..e0ba840 100755 --- a/RGens/data/sample-grammars/tarotcard.gram +++ b/RGens/data/sample-grammars/tarotcard.gram @@ -1,4 +1,4 @@ -[card] [adjective-of] [title] +[tarot-card] [adjective-of] [title] [adjective-of] [noun] [title] [noun] [noun] [adjective] @@ -7,7 +7,7 @@ [title] [adjective] [title] [adjective] [noun] -pragma initial-rule [card] +pragma initial-rule [tarot-card] [title] [male-title] [female-title] diff --git a/RGens/data/sample-grammars/technobabble.gram b/RGens/data/sample-grammars/technobabble.gram index 451f1f8..e512047 100755 --- a/RGens/data/sample-grammars/technobabble.gram +++ b/RGens/data/sample-grammars/technobabble.gram @@ -1,8 +1,8 @@ -[main] [part-prefix] [part-suffix] [part-problem] +[technobabble] [part-prefix] [part-suffix] [part-problem] [part-prefix] [part-problem] [part-suffix] [part-problem] -pragma initial-rule [main] +pragma initial-rule [technobabble] [part-prefix] primary compression diff --git a/RGens/data/sample-grammars/townname.long b/RGens/data/sample-grammars/townname.long new file mode 100644 index 0000000..077c6f5 --- /dev/null +++ b/RGens/data/sample-grammars/townname.long @@ -0,0 +1,141 @@ +Sullivan +Jakin +Geneva +Coleharbor +Cadiz +Dawson +Turon +Salem +Pax +Dakota +Moorefield +Zenda +Mettawa +Orchard +Busby +Cloudcroft +Perla +Burlington +Morrison +Blackburn +Jerico +Skykomish +Dupree +Dawson +Bowers +Star +Dorrance +Roberts +Carbon +Hopedale +Croghan +Elgin +Holland +Berkley +Sherrill +Varna +Owen +Oxford +Drake +Notus +Hobgood +Thacker +Springfield +Fraser +Avon +Audubon +Waterloo +Windsor +Atoka +Cherry +Hudson +Kechi +Pickstown +Elizabeth +Holt +Stapleton +Kell +Gardena +Osceola +Moscow +Morrison +Mustang +Maxwell +Francis +Eureka +Darlington +Ely +Bancroft +Hanover +Milano +Cabery +Byars +Gully +Sherwood +Reklaw +Watkins +Heartwell +Dawson +Vermont +Goldville +Paxson +Potwin +Sherman +Glenbeulah +Sunset +Clearwater +Solen +Altamont +Dyer +Murray +Rathbun +Huntleigh +Poulan +Burlington +Jackson +Verndale +Cleveland +Josephine +Leland +Carrollton +Vance +Sumner +Tira +Mead +Gumbranch +Glenwood +Harrison +Hannibal +Carthage +Callao +Bussey +Coaldale +Chugwater +Andale +Adell +Farber +Carlton +Prue +Tenney +Walcott +Udall +Brighton +Minburn +Swan +Frazer +Menlo +Bassett +Massena +Trommald +Waynesfield +Lynd +Mendon +Hammond +Simsboro +Thornton +Crary +Reynolds +Turton +Perry +Penasco +Loami diff --git a/RGens/data/sample-grammars/username.gram b/RGens/data/sample-grammars/username.gram new file mode 100644 index 0000000..c2ea622 --- /dev/null +++ b/RGens/data/sample-grammars/username.gram @@ -0,0 +1,12 @@ +[username] [[actual-username]] + +pragma initial-rule [username] + +[actual-username] [random-name] + [middle-initial] [random-name] + [middle-initial] [last-name] + [first-name] . [last-name] + [first-name] + [random-name] [num-range] + +pragma range-rule [num-range] 1 999 diff --git a/RGens/data/sample-grammars/web.gram b/RGens/data/sample-grammars/web.gram new file mode 100644 index 0000000..f17309b --- /dev/null +++ b/RGens/data/sample-grammars/web.gram @@ -0,0 +1,89 @@ +[email] [[actual-email]] + +[fake-email] [[actual-fake-email]] + +[username] [[actual-username]] + +[url] [[actual-url]] + +pragma initial-rule [email] +pragma export-rule [fake-email] +pragma export-rule [username] +pragma export-rule [url] + +[actual-email] [username] @ [subdomain-name] . [domain] + [username] @mail. [domain] + [username] @ [domain] + [username] @ [domain] + [acronym] @ [domain] + [email-alias] @ [domain] + [email-alias] @ [subdomain-name] . [domain] + [username] @ [subdomain-name] . [town-name] .net + [first-name] @ [last-name] .com + [first-name] @ [first-last] . [big-tld] + +[first-last] [first-name] + [first-name] - [last-name] + +[actual-fake-email] [username] @ [subdomain-name] . [fake-domain] + [username] @mail. [fake-domain] + [acronym] @ [fake-domain] + [email-alias] @ [fake-domain] + [email-alias] @ [subdomain-name] . [fake-domain] + +[email-alias] webmaster + abuse + hostmaster + postman + webjockey + email + sales + support + marketingscum + mail + root + + +[actual-username] [random-name] + [middle-initial] [random-name] + [middle-initial] [last-name] + [first-name] . [last-name] + [first-name] + [random-name] [num-range] + +pragma range-rule [num-range] 1 999 + +[actual-url] http://www. [domain] / + http://www. [domain] / + http:// [subdomain-name] . [domain] / + http://www. [last-name] . [tld] / + http:// [username] . [domain] / + [url-with-path] + +[url-with-path] http://www.geocities.com/ [neighborhood] / [digit-non0] [digit] [digit] [digit] / + http:// [url-begin] . [acronym] .net/ [url-username] / + + +[neighborhood] siliconvalley + heartland + timessquare + +[url-begin] www + www2 + users + members + +[url-username] [username] + ~ [username] + +[url-state] s + n + e + w + se + nw + ne + sw + univ + u + diff --git a/RGens/data/sample-grammars/zadrons-pouch.gram b/RGens/data/sample-grammars/zadrons-pouch.gram index 48b6e07..bb76faa 100755 --- a/RGens/data/sample-grammars/zadrons-pouch.gram +++ b/RGens/data/sample-grammars/zadrons-pouch.gram @@ -1,12 +1,12 @@ -[items] [item] - [item] and a [item] - [item] and a [item] as well as a [item] - [item] or [item] - [item] or [item] or maybe [item] +[zadrons-pouch] [zadrons-item] + [zadrons-item] and a [zadrons-item] + [zadrons-item] and a [zadrons-item] as well as a [zadrons-item] + [zadrons-item] or [zadrons-item] + [zadrons-item] or [zadrons-item] or maybe [zadrons-item] -pragma initial-rule [items] +pragma initial-rule [zadrons-pouch] -[item] [egg] +[zadrons-item] [egg] [glove] [crys-sphere] [rock] @@ -19,6 +19,8 @@ pragma initial-rule [items] [box] [wand] +pragma export-rule [zadrons-item] + [bag] bag of [bag-type] [sack-type] sack [purse-type] purse diff --git a/RGens/data/server-config-sample.cfg b/RGens/data/server-config-sample.cfg new file mode 100644 index 0000000..e69246a --- /dev/null +++ b/RGens/data/server-config-sample.cfg @@ -0,0 +1,38 @@ +# Load Diablo II grammar +data/sample-grammars/diablo-ii/diabloii.gram +data/sample-grammars/diablo-ii/diabloiiitems.gram +data/sample-grammars/diablo-ii/diabloiiperish.gram +data/sample-grammars/diablo-ii/diabloiiprefixes.gram +data/sample-grammars/diablo-ii/diabloiisuffixes.gram + +# Misc. grammars +data/sample-grammars/24hr-rpg.gram +data/sample-grammars/anime.gram +data/sample-grammars/art-objects.gram +data/sample-grammars/awe-names.gram +data/sample-grammars/college.gram +data/sample-grammars/dungeon-enviroment.gram +data/sample-grammars/email.gram +data/sample-grammars/fantasy-locations.gram +data/sample-grammars/genre-fiction.gram +data/sample-grammars/horror.gram +data/sample-grammars/insults.gram +data/sample-grammars/martial-arts.gram +data/sample-grammars/mary-sue.gram +data/sample-grammars/mission.gram +data/sample-grammars/part-creature.gram +data/sample-grammars/pokeattacks.gram +data/sample-grammars/rune.gram +data/sample-grammars/superhero.gram +data/sample-grammars/tarotcard.gram +data/sample-grammars/technobabble.gram +data/sample-grammars/zadrons-pouch.gram + +# Long rules +data/sample-grammars/firstname-female.long first-name-female +data/sample-grammars/firstname-male.long first-name-male +data/sample-grammars/lastname.long last-name +data/sample-grammars/realcity.long real-city +data/sample-grammars/realcompany.long real-company +data/sample-grammars/syllable.long syllable +data/sample-grammars/townname.long town-name diff --git a/RGens/pom.xml b/RGens/pom.xml index 10a10be..425028c 100644 --- a/RGens/pom.xml +++ b/RGens/pom.xml @@ -17,6 +17,10 @@ <version>1.2.1</version> <configuration> <mainClass>bjc.RGens.server.GrammarServer</mainClass> + <arguments> + <argument>-c</argument> + <argument>data/server-config-sample.cfg</argument> + </arguments> </configuration> </plugin> </plugins> diff --git a/RGens/src/main/.DS_Store b/RGens/src/main/.DS_Store Binary files differindex 63b728b..8db16a3 100644 --- a/RGens/src/main/.DS_Store +++ b/RGens/src/main/.DS_Store diff --git a/RGens/src/main/java/bjc/RGens/server/GrammarServer.java b/RGens/src/main/java/bjc/RGens/server/GrammarServer.java index afeb120..8c438c3 100644 --- a/RGens/src/main/java/bjc/RGens/server/GrammarServer.java +++ b/RGens/src/main/java/bjc/RGens/server/GrammarServer.java @@ -2,29 +2,28 @@ package bjc.RGens.server; import bjc.utils.funcdata.FunctionalMap; import bjc.utils.funcdata.IMap; -import bjc.utils.funcdata.IList; -import bjc.utils.funcutils.ListUtils; import bjc.utils.gen.WeightedGrammar; import java.io.File; -import java.io.IOException; -import java.io.FileInputStream; import java.util.Scanner; public class GrammarServer { private Scanner scn; - public final IMap<String, WeightedGrammar<String>> loadedGrammars; - - public final IMap<String, WeightedGrammar<String>> exportedRules; - + private IMap<String, WeightedGrammar<String>> loadedGrammars; + private IMap<String, WeightedGrammar<String>> exportedRules; + + private GrammarServerEngine eng; + public GrammarServer(Scanner scn) { this.scn = scn; this.loadedGrammars = new FunctionalMap<>(); this.exportedRules = new FunctionalMap<>(); + eng = new GrammarServerEngine(loadedGrammars, exportedRules); + ServerGrammarReader.setExportedRules(exportedRules); } @@ -35,6 +34,8 @@ public class GrammarServer { GrammarServer serv = new GrammarServer(scn); + CLIArgsParser.parseArgs(args, serv.eng); + System.out.print("Enter a command (m for help): "); char comm = scn.nextLine().charAt(0); @@ -50,7 +51,7 @@ public class GrammarServer { System.out.println("\tg: Generate text"); break; case 'g': - serv.generateText(); + serv.generateMode(); break; case 's': serv.showMode(); @@ -70,10 +71,12 @@ public class GrammarServer { System.out.println("GrammarServer exiting"); } + + private void loadMode() { System.out.println("Entering Load Mode"); - System.out.print("(Load Mode) Enter a command (m for help):"); + System.out.print("(Load Mode) Enter a command (m for help): "); char comm = scn.nextLine().charAt(0); while(comm != 'e') { @@ -81,8 +84,9 @@ public class GrammarServer { case 'm': System.out.println("GrammarServer Load Mode Commands"); System.out.println("\tm: Show command help"); - System.out.println("\te: Exit Generate Mode"); + System.out.println("\te: Exit Load Mode"); System.out.println("\tg: Load grammar from a file"); + System.out.println("\tl: Load long rule from a file"); System.out.println("\tc: Load configuration from a file"); break; case 'g': @@ -91,39 +95,71 @@ public class GrammarServer { case 'c': loadConfig(); break; + case 'l': + loadLongRule(); + break; default: System.out.println("? Unrecognized Command"); } - System.out.print("(Load Mode) Enter a command (m for help):"); + System.out.print("(Load Mode) Enter a command (m for help): "); comm = scn.nextLine().charAt(0); } System.out.println("Exiting Load Mode"); } - private void loadConfig() { - System.out.print("Enter the file to load configuration from: "); - + private void loadGrammar() { + System.out.print("Enter path to load grammar from: "); + + String grammarPath = scn.nextLine().trim(); + + File grammarFile = new File(grammarPath); + + String grammarName = grammarFile.getName().trim(); + + grammarName = grammarName.substring(0, grammarName.lastIndexOf(".")); + + System.out.printf("Enter grammar name or press enter for" + + " the default (%s): ", grammarName); + + String inputName = scn.nextLine(); + + if(!inputName.equals("")) { + grammarName = inputName; + } + + eng.doLoadGrammar(grammarName, grammarPath); + + return; + } + + private void loadLongRule() { + System.out.print("Enter the file to load a long rule from: "); + String fileName = scn.nextLine().trim(); + File ruleFile = new File(fileName); - File inputFile = new File(fileName); + String tempName = ruleFile.getName(); + tempName = tempName.substring(0, tempName.lastIndexOf('.')); - try(FileInputStream inputStream = new FileInputStream(inputFile)) { - try(Scanner fle = new Scanner(inputStream)) { - while(fle.hasNextLine()) { - String line = fle.nextLine().trim(); + System.out.printf("Enter the name for the long rule (default %s): ", tempName); - String gramName = line.substring(0, line.indexOf(' ')); - String gramPath = line.substring(line.indexOf(' ') + 1, line.length()); + String ruleName = scn.nextLine().trim(); - loadGrammar(gramName, gramPath); - } - } - } catch(IOException ioex) { - System.out.printf("? Error reading configuration from file" - + " (reason: %s)", ioex.getMessage()); + if(ruleName.equals("")) { + ruleName = tempName; } + + eng.doLoadLongRule(ruleName, fileName); + } + + private void loadConfig() { + System.out.print("Enter the file to load configuration from: "); + + String fileName = scn.nextLine().trim(); + + eng.doLoadConfig(fileName); } private void showMode() { @@ -147,20 +183,10 @@ public class GrammarServer { showGrammarRules(); break; case 'x': - System.out.printf("Currently exported rules (%d total):\n", - exportedRules.getSize()); - - exportedRules.forEachKey(key -> { - System.out.println("\t" + key); - }); + eng.doShowExportedRules(); break; case 'l': - System.out.printf("Currently loaded grammars (%d total):\n", - loadedGrammars.getSize()); - - loadedGrammars.forEachKey(key -> { - System.out.println("\t" + key); - }); + eng.doShowLoadedGrammars(); break; default: System.out.println("? Unrecognized command"); @@ -177,42 +203,7 @@ public class GrammarServer { System.out.println("Exiting Show Mode"); } - private void showGrammarRules() { - System.out.print("Enter the name of the grammar (l to list): "); - String gramName = scn.nextLine().trim(); - - do { - if(gramName.equals("")) break; - - if(gramName.equals("l")) { - System.out.printf("Currently loaded grammars (%d total):\n", - loadedGrammars.getSize()); - - loadedGrammars.forEachKey(key -> { - System.out.println("\t" + key); - }); - } else if (loadedGrammars.containsKey(gramName)) { - WeightedGrammar<String> gram = loadedGrammars.get(gramName); - - IList<String> ruleNames = gram.getRuleNames(); - - System.out.printf("Rules for grammar %s (%d total)\n", - gramName, ruleNames.getSize()); - - ruleNames.forEach(rule -> { - System.out.println("\t" + rule); - }); - break; - } else { - System.out.println("? Unrecognized grammar name"); - } - - System.out.print("Enter the name of the grammar (l to list): "); - gramName = scn.nextLine().trim(); - } while(true); - } - - private void generateText() { + private void generateMode() { System.out.println("Entering Generate Mode"); System.out.print("(Generate Mode) Enter a command (m for help): "); @@ -225,11 +216,15 @@ public class GrammarServer { System.out.println("GrammarServer Generate Mode Commands: "); System.out.println("\tm: Show command help"); System.out.println("\tx: Generate from exported rules"); + System.out.println("\tr: Generate from a grammar"); System.out.println("\te: Exit Generate Mode"); break; case 'x': generateExportedRule(); break; + case 'r': + generateGrammar(); + break; default: System.out.println("? Unrecognized command"); } @@ -252,17 +247,9 @@ public class GrammarServer { if(ruleName.equals("")) break; if(ruleName.equals("l")) { - System.out.println("Current exported rules: "); - exportedRules.forEachKey(key -> { - System.out.println("\t" + key); - }); + eng.doShowExportedRules(); } else if (exportedRules.containsKey(ruleName)) { - String ruleResult = ListUtils.collapseTokens( - exportedRules.get(ruleName) - .generateListValues(ruleName, " ")); - - System.out.println("Generated Result: "); - System.out.println("\t" + ruleResult.replaceAll("\\s+", " ")); + eng.doGenerateExportedRule(ruleName); System.out.print("Generate again from this rule? (yes/no) (yes by default): "); @@ -282,52 +269,78 @@ public class GrammarServer { } } - private void loadGrammar() { - System.out.print("Enter path to load grammar from: "); + private void generateGrammar() { + System.out.print("Enter the name of the grammar to generate from (l to list, enter to cancel): "); - String grammarPath = scn.nextLine().trim(); + String grammarName = scn.nextLine().trim(); - File grammarFile = new File(grammarPath); - - String grammarName = grammarFile.getName().trim(); + while(true) { + if(grammarName.equals("")) break; - grammarName = grammarName.substring(0, grammarName.lastIndexOf(".")); + if(grammarName.equals("l")) { + eng.doShowLoadedGrammars(); + } else if(loadedGrammars.containsKey(grammarName)) { + WeightedGrammar<String> currentGram = loadedGrammars.get(grammarName); - System.out.printf("Enter grammar name or press enter for" - + " the default (%s): ", grammarName); + System.out.print("Enter the name of the rule to generate" + + " (l to list, enter to cancel): "); - String inputName = scn.nextLine(); + String ruleName = scn.nextLine().trim(); - if(!inputName.equals("")) { - grammarName = inputName; - } + while(true) { + if(ruleName.equals("")) break; - doLoadGrammar(grammarName, grammarPath); + if(ruleName.equals("l")) { + eng.doShowGrammarRules(grammarName); + } else if (currentGram.hasRule(ruleName)) { + eng.doGenerateGrammar(currentGram, ruleName); - return; - } + System.out.print("Generate again from this rule? (yes/no) (yes by default): "); - private void doLoadGrammar(String grammarName, String grammarPath) { - System.out.printf("Loading grammar (named %s) from path %s\n", - grammarName, grammarPath); + String resp = scn.nextLine().trim(); - try (FileInputStream inputStream = new FileInputStream(grammarPath)) { - WeightedGrammar<String> newGram = - ServerGrammarReader.fromStream(inputStream).merge((gram, exports) -> { - for(String export : exports.toIterable()) { - exportedRules.put(export, gram); + if(resp.equalsIgnoreCase("yes") || resp.equals("")) { + continue; + } + } else { + System.out.println("? Unrecognized grammar rule"); } - return gram; - }); + System.out.print("Enter the name of the rule to generate" + + " (l to list, enter to cancel): "); - loadedGrammars.put(grammarName, newGram); - } catch (IOException ioex) { - System.out.printf("? Error reading grammar from file" - + " (reason: %s)", ioex.getMessage()); + ruleName = scn.nextLine().trim(); + } + + } else { + System.out.println("? Unrecognized grammar name"); + } + + System.out.print("Enter the name of the grammar to generate from " + + "(l to list, enter to cancel): "); + + grammarName = scn.nextLine().trim(); } + } - System.out.printf("Loaded grammar (named %s) from path %s\n", - grammarName, grammarPath); + private void showGrammarRules() { + System.out.print("Enter the name of the grammar (l to list): "); + String gramName = scn.nextLine().trim(); + + do { + if(gramName.equals("")) break; + + if(gramName.equals("l")) { + eng.doShowLoadedGrammars(); + } else if (loadedGrammars.containsKey(gramName)) { + eng.doShowGrammarRules(gramName); + break; + } else { + System.out.println("? Unrecognized grammar name"); + } + + System.out.print("Enter the name of the grammar (l to list): "); + gramName = scn.nextLine().trim(); + } while(true); } } diff --git a/RGens/src/main/java/bjc/RGens/server/ServerGrammarReader.java b/RGens/src/main/java/bjc/RGens/server/ServerGrammarReader.java index 9314c0c..62c59ff 100644 --- a/RGens/src/main/java/bjc/RGens/server/ServerGrammarReader.java +++ b/RGens/src/main/java/bjc/RGens/server/ServerGrammarReader.java @@ -25,36 +25,20 @@ import bjc.utils.parserutils.RuleBasedConfigReader; * */ public class ServerGrammarReader { - private static RuleBasedConfigReader<ReaderState> reader; - - private static Random numgen = new Random(); - - private static IMap<String, WeightedGrammar<String>> exportedRules; - - public static void setExportedRules(IMap<String, WeightedGrammar<String>> rules) { - exportedRules = rules; - } - static { setupReader(); - + initPragmas(); } - private static void debugGrammar(ReaderState state) { - System.out.println("Printing rule names: "); - - for (String currentRule : state.getRuleNames().toIterable()) { - System.out.println("\t" + currentRule); - } + private static RuleBasedConfigReader<ReaderState> reader; - System.out.println(); - } + private static Random numgen = new Random(); - private static void doCase(FunctionalStringTokenizer tokenizer, ReaderState state) { - int ruleProbability = readOptionalProbability(tokenizer, state); + private static IMap<String, WeightedGrammar<String>> exportedRules; - state.addCase(ruleProbability, tokenizer.toList()); + public static void setExportedRules(IMap<String, WeightedGrammar<String>> rules) { + exportedRules = rules; } /** @@ -69,150 +53,206 @@ public class ServerGrammarReader { public static IPair<WeightedGrammar<String>, IList<String>> fromStream(InputStream inputStream) { ReaderState initialState = new ReaderState(); - + WeightedGrammar<String> gram = reader.fromStream(inputStream, initialState).getGrammar(); - + IMap<String, IList<String>> vars = new FunctionalMap<>(); - + Predicate<String> specialPredicate = (strang) -> { - if(strang.matches("\\{\\S+\\}") || strang.matches("\\[\\S+\\}")) { + if(strang.matches("\\[\\S+\\]")) { return true; } - + return false; }; - + BiFunction<String, WeightedGrammar<String>, IList<String>> specialAction = (strang, gramm) -> { - IList<String> retList = new FunctionalList<>(); - - if(strang.matches("\\{\\S+\\}")) { - if(strang.matches("\\{\\S+:=\\S+\\}")) { - String[] varParts = strang.split(":="); - - String varName = varParts[0].substring(1); - String ruleName = varParts[1].substring(0, varParts[1].length()); - - IList<String> varValue = gramm.generateGenericValues( - ruleName, (s) -> s, " "); - - vars.put(varName, varValue); - } else if(strang.matches("\\{\\S+=\\S+\\}")) { - String[] varParts = strang.split("="); - - String varName = varParts[0].substring(1); - String varValue = varParts[1].substring(0, varParts[1].length()); - - vars.put(varName, new FunctionalList<>(varValue)); - } else { - // @FIXME notify the user they did something wrong - retList.add(strang); - } - } else { - if(strang.matches("\\[\\$\\S+\\]")) { - String varName = strang.substring(2, strang.length()); - - retList = vars.get(varName); - } else if(strang.matches("\\[\\$\\S+\\-\\S+\\]")) { - String[] varParts = strang.substring(1, strang.length()).split("-"); - - StringBuilder actualName = new StringBuilder("["); - - for(String varPart : varParts) { - if(varPart.startsWith("$")) { - IList<String> varName = vars.get(varPart.substring(1)); - - if(varName.getSize() != 1) { - // @FIXME notify the user they did something wrong - } - - actualName.append(varName.first() + "-"); - } else { - actualName.append(varPart + "-"); - } - } - - // Trim trailing - - actualName.deleteCharAt(actualName.length() - 1); - actualName.append("]"); - - retList = gramm.generateGenericValues(actualName.toString(), (s) -> s, " "); - } else if (exportedRules.containsKey(strang)) { - return exportedRules.get(strang) - .generateGenericValues(strang, (s) -> s, " "); - } else { - // @FIXME notify the user they did something wrong - retList.add(strang); - } - } - - return retList; + return handleSpecialRule(vars, strang, gramm); }; - + gram.configureSpecial(specialPredicate, specialAction); - - return new Pair<>(gram, initialState.getExports()); - } - - private static void initialRule(FunctionalStringTokenizer tokenizer, ReaderState state) { - String initialRuleName = tokenizer.nextToken(); - - state.setInitialRule(initialRuleName); + + IList<String> exports = initialState.getExports(); + + if(gram.getInitialRule() != null && !exports.contains(gram.getInitialRule())) { + exports.add(gram.getInitialRule()); + } + + return new Pair<>(gram, exports); } private static void initPragmas() { reader.addPragma("debug", (tokenizer, state) -> { debugGrammar(state); }); - + reader.addPragma("uniform", (tokenizer, state) -> { state.toggleUniformity(); }); - + reader.addPragma("initial-rule", ServerGrammarReader::initialRule); - + reader.addPragma("remove-rule", ServerGrammarReader::removeRule); - + reader.addPragma("prefix-with", ServerGrammarReader::prefixRule); reader.addPragma("suffix-with", ServerGrammarReader::suffixRule); - - reader.addPragma("regex-rule", (tokenizer, state) -> { + + reader.addPragma("regex-rule", ServerGrammarReader::handleRegexRule); + + reader.addPragma("range-rule", ServerGrammarReader::handleRangeRule); + + reader.addPragma("export-rule", (tokenizer, state) -> { String ruleName = tokenizer.nextToken(); + + state.addExport(ruleName); + }); + } - IList<String> regx = tokenizer.toList(); - Generex regex = new Generex(ListUtils.collapseTokens(regx)); - - state.addSpecialRule(ruleName, () -> { - return new FunctionalList<>(regex.random().split(" ")); + private static void setupReader() { + reader = new RuleBasedConfigReader<>(null, null, null); + + reader.setStartRule((tokenizer, stateTokenPair) -> { + stateTokenPair.doWith((initToken, state) -> { + state.startNewRule(initToken); + + doCase(tokenizer, state); }); }); + + reader.setContinueRule((tokenizer, state) -> { + doCase(tokenizer, state); + }); + + reader.setEndRule((tokenizer) -> { + tokenizer.setCurrentRule(null); + }); + } - reader.addPragma("range-rule", (tokenizer, state) -> { - String ruleName = tokenizer.nextToken(); + private static void debugGrammar(ReaderState state) { + System.out.println("Printing rule names: "); - int start = Integer.parseInt(tokenizer.nextToken()); - int end = Integer.parseInt(tokenizer.nextToken()); + for (String currentRule : state.getRuleNames().toIterable()) { + System.out.println("\t" + currentRule); + } - state.addSpecialRule(ruleName, () -> { - return new FunctionalList<>(Integer.toString( - numgen.nextInt((end - start) + 1) + start)); - }); - }); + System.out.println(); + } - reader.addPragma("export-rule", (tokenizer, state) -> { - String ruleName = tokenizer.nextToken(); + private static void doCase(FunctionalStringTokenizer tokenizer, ReaderState state) { + int ruleProbability = readOptionalProbability(tokenizer, state); - state.addExport(ruleName); + state.addCase(ruleProbability, tokenizer.toList()); + } + + private static void initialRule(FunctionalStringTokenizer tokenizer, ReaderState state) { + String initialRuleName = tokenizer.nextToken(); + + state.setInitialRule(initialRuleName); + } + + private static IList<String> handleSpecialRule(IMap<String, IList<String>> vars, String strang, + WeightedGrammar<String> gramm) { + IList<String> retList = new FunctionalList<>(); + + if(strang.matches("\\[\\[\\S+\\]\\]")) { + if(strang.matches("\\[\\S+:=\\S+\\]")) { + String[] varParts = strang.split(":="); + + String varName = varParts[0].substring(1); + String ruleName = varParts[1].substring(0, varParts[1].length()); + + IList<String> varValue = gramm.generateGenericValues( + ruleName, (s) -> s, " "); + + vars.put(varName, varValue); + } else if(strang.matches("\\[\\[\\S+=\\S+\\]\\]")) { + String[] varParts = strang.split("="); + + String varName = varParts[0].substring(1); + String varValue = varParts[1].substring(0, varParts[1].length()); + + vars.put(varName, new FunctionalList<>(varValue)); + } else if(strang.matches("\\[\\[\\S+\\]\\]")) { + String ruleName = strang.substring(1, strang.length() - 1); + + IList<String> ruleValue = gramm.generateGenericValues( + ruleName, (s) -> s, ""); + + retList.add(ListUtils.collapseTokens(ruleValue)); + } else { + // @FIXME notify the user they did something wrong + retList.add(strang); + } + } else { + if(strang.matches("\\[\\$\\S+\\]")) { + String varName = strang.substring(2, strang.length()); + + retList = vars.get(varName); + } else if(strang.matches("\\[\\$\\S+\\-\\S+\\]")) { + String[] varParts = strang.substring(1, strang.length()).split("-"); + + StringBuilder actualName = new StringBuilder("["); + + for(String varPart : varParts) { + if(varPart.startsWith("$")) { + IList<String> varName = vars.get(varPart.substring(1)); + + if(varName.getSize() != 1) { + // @FIXME notify the user they did something wrong + } + + actualName.append(varName.first() + "-"); + } else { + actualName.append(varPart + "-"); + } + } + + // Trim trailing - + actualName.deleteCharAt(actualName.length() - 1); + actualName.append("]"); + + retList = gramm.generateGenericValues(actualName.toString(), (s) -> s, " "); + } else if (exportedRules.containsKey(strang) && + exportedRules.get(strang) != gramm && + !gramm.hasRule(strang)) { + // Only pick external rules if they are both + // a) in a different grammar + // b) not shadowed in the current grammar + WeightedGrammar<String> exportGram = exportedRules.get(strang); + + retList = exportGram.generateGenericValues(strang, (s) -> s, " "); + } else { + // @FIXME notify the user they did something wrong + retList.add(strang); + } + } + + return retList; + } + + private static void handleRangeRule(FunctionalStringTokenizer tokenizer, ReaderState state) { + String ruleName = tokenizer.nextToken(); + + int start = Integer.parseInt(tokenizer.nextToken()); + int end = Integer.parseInt(tokenizer.nextToken()); + + state.addSpecialRule(ruleName, () -> { + int genNum = numgen.nextInt((end - start) + 1) + start; + + return new FunctionalList<>(Integer.toString(genNum)); }); } - private static void prefixRule(FunctionalStringTokenizer tokenizer, ReaderState state) { + private static void handleRegexRule(FunctionalStringTokenizer tokenizer, ReaderState state) { String ruleName = tokenizer.nextToken(); - String prefixToken = tokenizer.nextToken(); - int additionalProbability = readOptionalProbability(tokenizer, state); + IList<String> regx = tokenizer.toList(); + Generex regex = new Generex(ListUtils.collapseTokens(regx)); - state.prefixRule(ruleName, prefixToken, additionalProbability); + state.addSpecialRule(ruleName, () -> { + return new FunctionalList<>(regex.random().split(" ")); + }); } private static int readOptionalProbability(FunctionalStringTokenizer tokenizer, ReaderState state) { @@ -229,24 +269,13 @@ public class ServerGrammarReader { state.deleteRule(ruleName); } - private static void setupReader() { - reader = new RuleBasedConfigReader<>(null, null, null); - - reader.setStartRule((tokenizer, stateTokenPair) -> { - stateTokenPair.doWith((initToken, state) -> { - state.startNewRule(initToken); - - doCase(tokenizer, state); - }); - }); - - reader.setContinueRule((tokenizer, state) -> { - doCase(tokenizer, state); - }); - - reader.setEndRule((tokenizer) -> { - tokenizer.setCurrentRule(null); - }); + private static void prefixRule(FunctionalStringTokenizer tokenizer, ReaderState state) { + String ruleName = tokenizer.nextToken(); + String prefixToken = tokenizer.nextToken(); + + int additionalProbability = readOptionalProbability(tokenizer, state); + + state.prefixRule(ruleName, prefixToken, additionalProbability); } private static void suffixRule(FunctionalStringTokenizer tokenizer, ReaderState state) { |
