Author: lattner
Date: Mon Nov 5 13:25:14 2007
New Revision: 43726
URL: http://llvm.org/viewvc/llvm-project?rev=43726&view=rev
Log:
mention possibility of using a visitor
Modified:
llvm/trunk/docs/tutorial/LangImpl3.html
Modified: llvm/trunk/docs/tutorial/LangImpl3.html
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=43726&r1=43725&r2=43726&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl3.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl3.html Mon Nov 5 13:25:14 2007
@@ -62,7 +62,7 @@
class ExprAST {
public:
virtual ~ExprAST() {}
- virtual Value *Codegen() = 0;
+ <b>virtual Value *Codegen() = 0;</b>
};
/// NumberExprAST - Expression class for numeric literals like "1.0".
@@ -70,7 +70,7 @@
double Val;
public:
explicit NumberExprAST(double val) : Val(val) {}
- virtual Value *Codegen();
+ <b>virtual Value *Codegen();</b>
};
...
</pre>
@@ -88,6 +88,11 @@
href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
Assignment</a> - the concepts are really quite natural once you grok them.</p>
+<p>Note that instead of adding virtual methods to the ExprAST class hierarchy,
+it could also make sense to use a visitor pattern or some other way to model
+this. Again, this tutorial won't dwell on good software engineering practices:
+for our purposes, adding virtual methods is simplest.</p>
+
<p>The
second thing we want is an "Error" method like we used for parser, which will
be used to report errors found during code generation (for example, use of an
_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits