Author: coke
Date: Thu Oct  6 11:48:31 2005
New Revision: 9379

Modified:
   trunk/languages/tcl/TODO
   trunk/languages/tcl/lib/expression.pir
   trunk/languages/tcl/lib/parser.pir
Log:
update documentation



Modified: trunk/languages/tcl/TODO
==============================================================================
--- trunk/languages/tcl/TODO    (original)
+++ trunk/languages/tcl/TODO    Thu Oct  6 11:48:31 2005
@@ -26,7 +26,7 @@ Generate compiler-variants for several b
 commands like C<while>. 
 Modify the compiler for tclcommand to generate the inline version if
 it's available. (C<proc> and C<expr> should also be straightforward, as they
-already compile anyway.)  [Completed: incr, break, continue]
+already compile anyway.)  [Completed: incr, break, continue, for]
 
 Note: compiled builtins always take two args: the register_num to begin
 using for the inlined code, and a single container pmc that contains the
@@ -39,12 +39,6 @@ When an inline compiled version exists, 
 indicates no procs have been redifined.  Update proc and rename to increment
 this counter whenever they are called.
 
-=item 3
-
-provide a command line to tcl.pbc (C<-o>?) that collects the PIR and dumps it,
-instead of compiling and executing it. Perhaps the option could be smart enough
-to see if it was being sent to a PBC or a PIR output.
-
 =back
 
 =head2 Generic tasks

Modified: trunk/languages/tcl/lib/expression.pir
==============================================================================
--- trunk/languages/tcl/lib/expression.pir      (original)
+++ trunk/languages/tcl/lib/expression.pir      Thu Oct  6 11:48:31 2005
@@ -2,11 +2,23 @@
 
 .const int MAX_PRECEDENCE =  11
 
-=head1 _Tcl::__expression_parse
+=head1 NAME
 
-Given a string, return an invokable PMC that will generate the appropriate
-value described by this Tcl expression. An intermediate AST is generated,
-and the functions ends with a tailcall to the compiler.
+Tcl Expressions
+
+=head1 DESCRIPTION
+
+This is the parser that deals with all [expr] related code. (Include those used
+implicitly by commands like [while].
+
+=head FUNCTIONS
+
+=item C<(int register_num, string pir_code) = __expression_compile(int 
register_num, string expr)>
+
+Argument register_num is the first register number that is available for use 
by the
+generated PIR.
+
+Return register_num is the register number that contains the result of this 
code.
 
 =cut
 
@@ -22,6 +34,13 @@ and the functions ends with a tailcall t
   .return compiler(ast,register_num)
 .end
 
+=item C<(pmc ast) = __expression_ast(string expr)>
+
+Given a string representing a tcl [expr], return a PMC that represents the 
abstract
+syntax tree associated with this expression.
+
+=cut
+
 .sub __expression_ast
   .param string expr
 
@@ -61,7 +80,7 @@ operator:
 
 chunks_done:
 
-=for comment
+=for documentation
 
 Convert the chunks into a stack. For each level of precendence, 
 scan the chunk list for operators that match our level. As we find one, 

Modified: trunk/languages/tcl/lib/parser.pir
==============================================================================
--- trunk/languages/tcl/lib/parser.pir  (original)
+++ trunk/languages/tcl/lib/parser.pir  Thu Oct  6 11:48:31 2005
@@ -16,9 +16,12 @@ at <http://www.tcl.tk/man/tcl8.4/TclCmd/
 
 =item C<(int register_num, string pir_code) = compile(int register_num, string 
tcl_code)>
 
-Parses the Tcl code and returns an array of TclCommand objects.
-First, it performs the \<newline> substitution. Then it fetches
-commands, one at a time (skipping over comments).
+Parses the Tcl code and returns generated PIR code.
+
+Argument register_num is the first register number that is available for use 
by the
+generated PIR.
+
+Return register_num is the register number that contains the result of this 
code.
 
 =cut
 
@@ -92,6 +95,17 @@ done:
   .return "compile_dispatch"(commands,register_num)
 .end
 
+=item C<(pmc invokable) = pir_compiler(string PIR, int register_num)>
+
+A thin wrapper for the <compreg>'d PIR compiler. 
+Given PIR code, wrap it in anonymous subroutine, compile to bytecode, and 
return the
+compiled, anonymous sub.
+
+Argument register_num is the first register number that is available for use 
by the
+generated PIR.
+
+=cut
+
 .sub pir_compiler
   .param int result_reg
   .param string pir_code
@@ -642,10 +656,15 @@ done:
 .end
 
 
-=item C<(int reg_num, str code) = compile(pmc thing, int reg_num)>
+=item C<(int register_num, str code) = compile_dispatch(pmc thing, int 
register_num)>
+
+Given an object, call its compile method, or, if it's constant, generate
+code on its behalf. Returns PIR code.
+
+Argument register_num is the first register number that is available for use 
by the
+generated PIR.
 
-Given an object, call its compile method, or assume it's constant
-and generate the code for it.
+Return register_num is the register number that contains the result of this 
code.
 
 =cut
 

Reply via email to