Commits

Anonymous committed 6280ef2

fix description parsing, but ugly. primes.spl work

Comments (0)

Files changed (3)

example/primes.spl

+Prime Number Computation in Copenhagen.
+
+Romeo, a young man of Verona.
+Juliet, a young woman.
+Hamlet, a temporary variable from Denmark.
+The Ghost, a limiting factor (and by a remarkable coincidence also
+        Hamlet's father).
+
+
+                    Act I: Interview with the other side.
+
+                    Scene I: At the last hour before dawn.
+
+[Enter the Ghost and Juliet]
+
+The Ghost:
+ You pretty little warm thing! Thou art as prompt as the difference
+ between the square of thyself and your golden hair. Speak your mind.
+
+Juliet:
+ Listen to your heart!
+
+[Exit the Ghost]
+
+[Enter Romeo]
+
+Juliet:
+ Thou art as sweet as a sunny king!
+
+
+                    Act II: Determining divisibility.
+
+                    Scene I: A private conversation.
+
+Juliet:
+ Art thou more cunning than the Ghost?
+
+Romeo:
+ If so, let us proceed to scene V.
+
+[Exit Romeo]
+
+[Enter Hamlet]
+
+Juliet:
+ You are as villainous as the square root of Romeo!
+
+Hamlet:
+ You are as lovely as a red rose.
+
+                    Scene II: Questions and the consequences thereof.
+
+Juliet:
+ Am I better than you?
+
+Hamlet:
+ If so, let us proceed to scene III.
+
+Juliet:
+ Is the remainder of the quotient between Romeo and me as good as
+ nothing?
+
+Hamlet:
+ If so, let us proceed to scene IV.
+ Thou art as bold as the sum of thyself and a roman.
+
+Juliet:
+ Let us return to scene II.
+
+                    Scene III: Romeo must die!
+
+[Exit Hamlet]
+
+[Enter Romeo]
+
+Juliet:
+ Open your heart.
+
+[Exit Juliet]
+
+[Enter Hamlet]
+
+Romeo:
+ Thou art as rotten as the difference between nothing and the sum of a
+ snotty stinking half-witted hog and a small toad!
+ Speak your mind!
+
+[Exit Romeo]
+
+[Enter Juliet]
+
+                    Scene IV: One small dog at a time.
+
+[Exit Hamlet]
+
+[Enter Romeo]
+
+Juliet:
+ Thou art as handsome as the sum of thyself and my chihuahua!
+ Let us return to scene I.
+
+                    Scene V: Fin.
+
+[Exeunt]

src/parser/grammar.pg

 }
 
 rule title {
-    <-[.]>* <end> 
+    <description> <end> 
 }
 rule scene {
   'scene' <roman> ':' <description> <end>
 }
 
 rule io {
-  |'open' <second_person_possessive> 'heart'      {*} #= open_heart
-  |'speak' <second_person_possessive> 'mind'      {*} #= speak_mind
+  |'open' <second_person_possessive> 'heart' {*} #= open_heart
+  |'speak' <second_person_possessive> 'mind' {*} #= speak_mind
   |'listen' 'to' <second_person_possessive> 'heart' {*} #= listen_heart
-  |'open' <second_person_possessive> 'mind'       {*} #= open_mind
+  |'open' <second_person_possessive> 'mind' {*} #= open_mind
 }
 
 rule assignment {
 }
 
 rule enters {
- '[' 
+'[' 
   'enter' <charlist> {*} 
- ']'
+']'
 }
 rule exeunts {
 '[' 
  ']'
 }
 token description {
-  <-[.]>* 
+  <-[!?.]>* 
 }

src/parser/words.pg

  |'nicer'
  |'jollier'
 }
-rule positive_noun {
+token positive_noun {
  |'kingdom'
  |'heaven'
  |'king'
  |'happiness'
  |'joy'
  |'plum'
- |'summer\'s' 'day'
+ |'summer\'s' <ws> 'day'
  |'hero'
  |'rose'
  |'pony'