Anonymous avatar Anonymous committed a14419f

doc stuff

Comments (0)

Files changed (3)

 since we used the standard parrot's HLLCompiler you can use the usual flags 
 such as --target=(parse|pir) to see the parse three and the PIR output.
 
+INTERACTIVE PROMPT
+------------------
+You can also access the interpreter interactively. 
+Since setting up a whole play would be useless, you can input single sentences
+and see how they will be parsed:
+$ parrot shakespeare.pir
+Thou hast entered the interactive sentence verifier
+Enter a Sentence to see How It Parses
+>lol
+no match
+>king
+: <king @ 0> 0
+<value>: <king @ 0> 0
+<value><immediate>: <king @ 0> 0
+<value><immediate><noun>: <king @ 0> 0
+<value><immediate><noun><positive_noun>: <king @ 0> 0
+
+>twice a pretty king
+: <twice a pretty king @ 0> 0
+<value>: <twice a pretty king @ 0> 0
+<value><computation>: <twice a pretty king @ 0> 0
+<value><computation><unary>: <twice a pretty king @ 0> 0
+<value><computation><unary><value>: <a pretty king @ 6> 0
+<value><computation><unary><value><immediate>: <a pretty king @ 6> 0
+<value><computation><unary><value><immediate><article>[0]: <a @ 6> 0
+<value><computation><unary><value><immediate><adjective>[0]: <pretty @ 8> 0
+<value><computation><unary><value><immediate><adjective>[0]<positive_adjective>: <pretty @ 8> 0
+<value><computation><unary><value><immediate><noun>: <king @ 15> 0
+<value><computation><unary><value><immediate><noun><positive_noun>: <king @ 15> 0
+
+>let us proceed to scene III
+: <let us proceed to scene iii @ 0> 0
+<branch>: <let us proceed to scene iii @ 0> 0
+<branch><roman>: <iii @ 24> 0
+
+
+
+
 IMPLEMENTATION
 --------------
-The original SPL project generates C code that con be compiled and linked with
-libspl to generate executables, through SPLC.
+The original SPL project generates C code through spl2c that con 
+be compiled and linked and linked with libspl to generate executables.
 The parser is built with yacc/bison and the lexer is flex. The Perl port[4] uses
 the same parser and lexer.
 
 * the_speaker refers the current speaker, so that the references "thou" and "me"
   are meaningful. Using objects was another option.
 * the_condition is a boolean value that gets set from a 'question' statement 
-  ("is foo better than bar?") and is refrenced later. Inlining of the 
+  ("is foo better than bar?") and is referenced later. Inlining of the 
   value would require a lot of work when building the AST, while the bytecode 
   compiler should have no problems doing it. 
 
 
 Although I did not initially look at the original source code while writing 
-the interpreter it seems that the behaviour of SPLC is the same.
+the interpreter it seems that the behaviour of spl2c+libspl is the same.
 
 The list of valid words was originally generated from a list of wordlist files 
 with an AWK script I have lost track of. It's in the TODO list to fix it.
 would cause a failure to parse "an empty bottle" because the token 'a'
 is matched and the token does not backtracks. The grammar goes on trying to 
 match 'n' and thus fails. 
-The cases words where I had test failures were hand fixed, some may still 
-cause failures. 
+The words where I had test failures were hand fixed, some may still 
+cause failurese the interactive loop to check. 
 
 
 LANGUAGE EXTENSIONS 
 EXAMPLES
 --------
 The files in example are the original files used in both Lingua::Shakespeare and
-SPLC, and their operation is checked through the script t/test.rb.
+spl2c, and their operation is checked through the script t/test.rb.
 To verify that everything works you can run "make fulltest" which will execute
 both the standard test suite and the examples' test suite. 
 
 
 [1] http://shakespearelang.sourceforge.net/ 
 [2] http://web.archive.org/web/20080121104440/http://people.csa.iisc.ernet.in/sreejith/frontends/spl/spl.htm
-[3] http://www.parrotcodr.org
+[3] http://www.parrotcode.org
 [4] http://search.cpan.org/~gbarr/Lingua-Shakespeare-1.00/
 [5] http://testanything.org/wiki/index.php/Main_Page
 
  othello, you, me
 
+
+You can use the interactive loop (run the interpreter with no args)
+to check how statements are parsed.
+
 Notice that programs develop through usage of 
 first_persons and second_persons, so for example
 
        Remember me.    # 0 in stack, -1 stays as value
        Recall your ancestry! # empty stack, 0 as value
 
+Notice that everything afte 'recall' is ignored up to the sentence terminator.
+
 Please see the test suite and the examples/* files for 
 further information.
 
     # ignored
     .param pmc adverbs         :slurpy :named
     .local pmc rgx, stdin, match
-    .local pmc code # code has to be a pmc or a string conversion from null will die()
-    .local string output, prompt
+    .local string output, prompt, code
     prompt = '>'
     stdin = getstdin
     say "Thou hast entered the interactive sentence verifier"
     rgx= get_hll_global ['shakespeare';'Grammar'], 'sentence'
   loop: 
     unless stdin goto endloop
-    
-    code = stdin.'readline_interactive'(prompt)
-    if null code goto endloop
+    # need a pmc or a string conversion from null will die()
+    $P0 = stdin.'readline_interactive'(prompt)
+    if null $P0 goto endloop
+    code = $P0
     unless code goto loop
+    downcase code
     match = rgx(code)
     if match goto dump
     say "no match"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.