Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73456 - trunk/libs/spirit/example/qi/compiler_tutorial/conjure3
From: joel_at_[hidden]
Date: 2011-07-30 21:05:53


Author: djowel
Date: 2011-07-30 21:05:52 EDT (Sat, 30 Jul 2011)
New Revision: 73456
URL: http://svn.boost.org/trac/boost/changeset/73456

Log:
expression assignments working
Text files modified:
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/compiler.cpp | 30 +++++++++++-------------------
   1 files changed, 11 insertions(+), 19 deletions(-)

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/compiler.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/compiler.cpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/compiler.cpp 2011-07-30 21:05:52 EDT (Sat, 30 Jul 2011)
@@ -172,12 +172,6 @@
         return precedence[op & 0xFF];
     }
 
- inline bool is_left_assoc(token_ids::type op)
- {
- // only the assignment operators are right to left
- return (op & token_ids::op_assign) == 0;
- }
-
     llvm::Value* compiler::compile_binary_expression(
         llvm::Value* lhs, llvm::Value* rhs, token_ids::type op)
     {
@@ -246,21 +240,19 @@
 
     llvm::Value* compiler::operator()(ast::assignment const& x)
     {
- //~ llvm::Value* lhs = named_values[x.lhs.name];
- //~ if (lhs == 0)
- //~ {
- //~ error_handler(x.lhs.id, "Undeclared variable: " + x.lhs.name);
- //~ return 0;
- //~ }
-
- //~ llvm::Value* rhs = (*this)(x.rhs);
- //~ if (rhs == 0)
- //~ return 0;
+ llvm::Value* lhs = named_values[x.lhs.name];
+ if (lhs == 0)
+ {
+ error_handler(x.lhs.id, "Undeclared variable: " + x.lhs.name);
+ return 0;
+ }
 
- //~ builder.CreateStore(rhs, lhs);
- //~ return rhs;
+ llvm::Value* rhs = (*this)(x.rhs);
+ if (rhs == 0)
+ return 0;
 
- return 0;
+ builder.CreateStore(rhs, lhs);
+ return rhs;
     }
 
     // Create an alloca instruction in the entry block of


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