SHARE
TWEET

Untitled

a guest May 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void main(String[] args) {
  2.         try {
  3.             String tmp = "float b = 10.36; int b; char b = 'h'; double fff; double dddd = 120.456;";
  4.  
  5.             Scanner scanner = new Scanner(System.in);
  6.             System.out.println("Podaj kod do C#  trnaslacji");
  7.  
  8.             tmp = scanner.nextLine();
  9.             ANTLRInputStream input = new ANTLRInputStream(tmp);
  10.             CSharpLexer lexer = new CSharpLexer(input);
  11.             CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
  12.             CSharpParser parser = new CSharpParser(commonTokenStream);
  13.             parser.setBuildParseTree(true);
  14.  
  15.             ParseTree tree = parser.program();
  16.             ParseTreeWalker walker = new ParseTreeWalker();
  17.             CSharpBaseListener listener = new CSharpBaseListener();
  18.             walker.walk(listener, tree);
  19.             System.out.println(listener.getTranslate());
  20.  
  21.         } catch (Exception e) {
  22.             System.err.println("exception: " + e);
  23.         }
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top