2 package com
.interrupt
.bookkeeping
.cc
;
4 import java
.io
.PushbackReader
;
5 import java
.io
.InputStreamReader
;
7 import org
.apache
.log4j
.Logger
;
9 import com
.interrupt
.bookkeeping
.cc
.bkell
.Bkell
;
10 import com
.interrupt
.bookkeeping
.cc
.lexer
.Lexer
;
11 import com
.interrupt
.bookkeeping
.cc
.node
.Start
;
12 import com
.interrupt
.bookkeeping
.cc
.parser
.Parser
;
15 public class Compiler
{
18 private Logger logger
= Logger
.getLogger(Compiler
.class);
21 this._init(new InputStreamReader(System
.in
));
23 public Compiler(Reader reader
) {
28 public void _init(Reader reader
) {
31 logger
.debug("Running Compiler. Input Expression >");
35 PushbackReader pbreader
= new PushbackReader( reader
, 1024 );
36 Lexer lexer
= new Lexer(pbreader
);
37 Parser parser
= new Parser(lexer
);
40 Start tree
= parser
.parse();
43 tree
.apply( new ExpressionVisitor() );
53 public static void main(String args
[]) {
55 Logger
.getLogger(Compiler
.class).debug("Running Compiler. Input Expression >");
58 PushbackReader pbreader
= new PushbackReader( new InputStreamReader(System
.in
), 1024 );
59 Lexer lexer
= new Lexer(pbreader
);
60 Parser parser
= new Parser(lexer
);
63 Start tree
= parser
.parse();
66 tree
.apply( new ExpressionVisitor() );