import java.awt.*; import java.io.IOException; class StackFehler extends Exception{ public StackFehler(){super();} public StackFehler(String s){super(s);} } class Ergebnistyp{ int Inhalt; } class Rekursion{ boolean P(Object x){ return false;} Ergebnistyp g(Object x){ return new Ergebnistyp(); } Ergebnistyp h(Object x, Ergebnistyp y){ return y;} Object r(Object x){ return x;} Ergebnistyp f(Object x){ if (P(x)) return g(x); else return h(x, f(r(x))); } } class Iteration{ boolean P(Object x){ return false;} Ergebnistyp g(Object x){ return new Ergebnistyp(); } Ergebnistyp h(Object x, Ergebnistyp y){ return y;} Object r(Object x){ return x;} Ergebnistyp f(Object x)throws StackFehler{ Stack s = new Stack(); while (!P(x)){ s.Push(x); x = r(x); } Ergebnistyp e = g(x); while (!s.istLeer()){ Object a = s.PopTop(); e = h(a, e); } return e; } } class ListNode{ Object e; ListNode next = null; ListNode(Object el){ e = el;} } class Stack{ private ListNode Liste = null; boolean istLeer (){ return Liste == null;} void Push (Object e){ ListNode NeueZelle = new ListNode(e); NeueZelle.next = Liste; Liste = NeueZelle; } void Pop () throws StackFehler { if (istLeer()) throw new StackFehler("StackFehler: Zugriff auf leeren Stack !"); Liste = Liste.next; } Object Top () throws StackFehler { if (istLeer()) throw new StackFehler("StackFehler: Zugriff auf leeren Stack !"); return Liste.e; } Object PopTop () throws StackFehler { Object e = Top(); Pop(); return e; } } public class LiStack { public static void main(String args[]) { } }