001: /* -*- mode: Java; c-basic-offset: 2; -*- */
002:
003: /**
004: * Common Code for Translation and Code Generation
005: *
006: * @author steele@osteele.com
007: * @author ptw@openlaszlo.org
008: * @author dda@ddanderson.com
009: * @description: Common baseclass for code generators
010: *
011: * This class is extended by CodeGenerator, JavascriptGenerator.
012: */package org.openlaszlo.sc;
013:
014: import java.io.*;
015: import java.util.*;
016: import java.nio.ByteBuffer;
017:
018: import org.openlaszlo.sc.parser.*;
019: import org.openlaszlo.sc.Instructions;
020: import org.openlaszlo.sc.Instructions.Instruction;
021:
022: import org.openlaszlo.cache.PersistentMap;
023:
024: /**
025: * Methods to visit each kind of object in the AST.
026: */
027: public interface ASTVisitor {
028:
029: SimpleNode visitArrayLiteral(SimpleNode node, boolean isReferenced,
030: SimpleNode[] children);
031:
032: SimpleNode visitAssignmentExpression(SimpleNode node,
033: boolean isReferenced, SimpleNode[] children);
034:
035: SimpleNode visitBinaryExpressionSequence(SimpleNode node,
036: boolean isReferenced, SimpleNode[] children);
037:
038: SimpleNode visitCallExpression(SimpleNode node,
039: boolean isReferenced, SimpleNode[] children);
040:
041: SimpleNode visitConditionalExpression(SimpleNode node,
042: boolean isReferenced, SimpleNode[] children);
043:
044: SimpleNode visitDoWhileStatement(SimpleNode node,
045: SimpleNode[] children);
046:
047: SimpleNode visitEmptyExpression(SimpleNode node,
048: boolean isReferenced, SimpleNode[] children);
049:
050: SimpleNode visitExpression(SimpleNode node);
051:
052: SimpleNode visitExpression(SimpleNode node, boolean isReferenced);
053:
054: SimpleNode visitExpressionList(SimpleNode node,
055: boolean isReferenced, SimpleNode[] children);
056:
057: SimpleNode visitForInStatement(SimpleNode node,
058: SimpleNode[] children);
059:
060: SimpleNode visitForStatement(SimpleNode node, SimpleNode[] children);
061:
062: SimpleNode visitForVarStatement(SimpleNode node,
063: SimpleNode[] children);
064:
065: SimpleNode visitFunctionCallParameters(SimpleNode node,
066: boolean isReferenced, SimpleNode[] children);
067:
068: SimpleNode visitFunctionDeclaration(SimpleNode node,
069: SimpleNode[] ast);
070:
071: SimpleNode visitFunctionExpression(SimpleNode node,
072: boolean isReferenced, SimpleNode[] children);
073:
074: SimpleNode visitIdentifier(SimpleNode node, boolean isReferenced,
075: SimpleNode[] children);
076:
077: SimpleNode visitIfStatement(SimpleNode node, SimpleNode[] children);
078:
079: SimpleNode visitLiteral(SimpleNode node, boolean isReferenced,
080: SimpleNode[] children);
081:
082: SimpleNode visitNewExpression(SimpleNode node,
083: boolean isReferenced, SimpleNode[] children);
084:
085: SimpleNode visitObjectLiteral(SimpleNode node,
086: boolean isReferenced, SimpleNode[] children);
087:
088: SimpleNode visitPostfixExpression(SimpleNode node,
089: boolean isReferenced, SimpleNode[] children);
090:
091: SimpleNode visitPrefixExpression(SimpleNode node,
092: boolean isReferenced, SimpleNode[] children);
093:
094: SimpleNode visitProgram(SimpleNode node, SimpleNode[] directives,
095: String cpass);
096:
097: SimpleNode visitProgram(SimpleNode node, SimpleNode[] directives,
098: String cpass, boolean top);
099:
100: SimpleNode visitPropertyIdentifierReference(SimpleNode node,
101: boolean isReferenced, SimpleNode[] children);
102:
103: SimpleNode visitPropertyValueReference(SimpleNode node,
104: boolean isReferenced, SimpleNode[] children);
105:
106: SimpleNode visitReturnStatement(SimpleNode node,
107: SimpleNode[] children);
108:
109: SimpleNode visitStatement(SimpleNode node, SimpleNode[] children);
110:
111: SimpleNode visitSuperCallExpression(SimpleNode node,
112: boolean isReferenced, SimpleNode[] children);
113:
114: SimpleNode visitSwitchStatement(SimpleNode node,
115: SimpleNode[] children);
116:
117: SimpleNode visitThisReference(SimpleNode node,
118: boolean isReferenced, SimpleNode[] children);
119:
120: SimpleNode visitThrowStatement(SimpleNode node,
121: SimpleNode[] children);
122:
123: SimpleNode visitTryStatement(SimpleNode node, SimpleNode[] children);
124:
125: SimpleNode visitUnaryExpression(SimpleNode node,
126: boolean isReferenced, SimpleNode[] children);
127:
128: SimpleNode visitVariableDeclaration(SimpleNode node,
129: SimpleNode[] children);
130:
131: SimpleNode visitVariableDeclarationList(SimpleNode node,
132: SimpleNode[] children);
133:
134: SimpleNode visitVariableStatement(SimpleNode node,
135: SimpleNode[] children);
136:
137: SimpleNode visitWhileStatement(SimpleNode node,
138: SimpleNode[] children);
139:
140: SimpleNode visitWithStatement(SimpleNode node, SimpleNode[] children);
141: }
142:
143: /**
144: * @copyright Copyright 2006-2008 Laszlo Systems, Inc. All Rights
145: * Reserved. Use is subject to license terms.
146: */
|