01: /**************************************************************************/
02: /* N I C E */
03: /* A high-level object-oriented research language */
04: /* (c) Daniel Bonniot 2004 */
05: /* */
06: /* This program is free software; you can redistribute it and/or modify */
07: /* it under the terms of the GNU General Public License as published by */
08: /* the Free Software Foundation; either version 2 of the License, or */
09: /* (at your option) any later version. */
10: /* */
11: /**************************************************************************/package bossa.syntax;
12:
13: import bossa.util.*;
14:
15: import java.util.*;
16:
17: /**
18: The Abstract Syntax Tree : a collection of definitions.
19:
20: @see Definition
21: */
22: public abstract class AST extends Node {
23: AST(List children, int propagate) {
24: super (children, propagate);
25: if (this .children == null)
26: this .children = new LinkedList();
27: }
28:
29: public List definitions() {
30: return children;
31: }
32:
33: abstract public void buildScope();
34:
35: abstract public void resolveScoping();
36:
37: abstract public void typedResolve();
38:
39: abstract public void localResolve();
40:
41: abstract public void typechecking(boolean compiling);
42:
43: public void printInterface(java.io.PrintWriter s) {
44: for (Iterator i = children.iterator(); i.hasNext();)
45: ((Definition) i.next()).printInterface(s);
46: }
47:
48: abstract public void compile(boolean generateCode);
49:
50: public int numberOfDeclarations() {
51: return children.size();
52: }
53:
54: }
|