Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69623 - trunk/libs/spirit/example/qi/compiler_tutorial/mini_c
From: joel_at_[hidden]
Date: 2011-03-07 05:27:56


Author: djowel
Date: 2011-03-07 05:27:49 EST (Mon, 07 Mar 2011)
New Revision: 69623
URL: http://svn.boost.org/trac/boost/changeset/69623

Log:
Quick tweaks
Text files modified:
   trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.cpp | 9 ---------
   trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.hpp | 1 -
   trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp | 7 ++-----
   trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/function_def.hpp | 11 ++++-------
   4 files changed, 6 insertions(+), 22 deletions(-)

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.cpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.cpp 2011-03-07 05:27:49 EST (Mon, 07 Mar 2011)
@@ -53,15 +53,6 @@
         function_calls[address] = name;
     }
 
- void function::print_variables(std::vector<int> const& stack) const
- {
- typedef std::pair<std::string, int> pair;
- BOOST_FOREACH(pair const& p, variables)
- {
- std::cout << " " << p.first << ": " << stack[p.second] << std::endl;
- }
- }
-
     void function::print_assembler() const
     {
         std::vector<int>::const_iterator pc = code.begin() + address;

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/compiler.hpp 2011-03-07 05:27:49 EST (Mon, 07 Mar 2011)
@@ -42,7 +42,6 @@
         void add_var(std::string const& name);
         void link_to(std::string const& name, std::size_t address);
 
- void print_variables(std::vector<int> const& stack) const;
         void print_assembler() const;
 
     private:

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/expression_def.hpp 2011-03-07 05:27:49 EST (Mon, 07 Mar 2011)
@@ -133,13 +133,8 @@
> ')'
             ;
 
- //~ argument_list =
- //~ (expr > *(',' > expr)) // $$$$
- //~ ;
-
         argument_list = -(expr % ',');
 
-
         identifier =
                 !keywords
>> raw[lexeme[(alpha | '_') >> *(alnum | '_')]]
@@ -156,6 +151,8 @@
             (multiplicative_expr)
             (unary_expr)
             (primary_expr)
+ (function_call)
+ (argument_list)
             (identifier)
         );
 

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/function_def.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/function_def.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/mini_c/function_def.hpp 2011-03-07 05:27:49 EST (Mon, 07 Mar 2011)
@@ -40,23 +40,20 @@
             ;
 
         identifier = name;
- argument_list = -(identifier > *(',' > identifier));
+ argument_list = -(identifier % ',');
 
         start =
                 lexeme[(string("void") | string("int"))
>> !(alnum | '_')] // make sure we have whole words
> identifier
- > '('
- > argument_list
- > ')'
- > '{'
- > body
- > '}'
+ > '(' > argument_list > ')'
+ > '{' > body > '}'
             ;
 
         // Debugging and error handling and reporting support.
         BOOST_SPIRIT_DEBUG_NODES(
             (identifier)
+ (argument_list)
             (start)
         );
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk