Skip to content

Latest commit

 

History

History
48 lines (48 loc) · 2.05 KB

File metadata and controls

48 lines (48 loc) · 2.05 KB

Java Translator

Main point of the project is to create a java translator from a "handmade" language.

What is translator?

A translator or programming language processor is a computer program that performs the translation of a program written in a given programming language into a functionally equivalent program in another computer language (the target language), without losing the functional or logical structure of the original code (the "essence" of each program).
Wiki page

How to use it?

  • Add a dependency to your project
    • Maven

      <dependency>
          <groupId>io.github.therealmone</groupId>
          <artifactId>JavaTranslator</artifactId>
          <version>1.1.0</version>
      </dependency>
    • Gradle

      compile 'io.github.therealmone:JavaTranslator:1.1.0'
    • Apache Ivy

      <dependency org="io.github.therealmone" name="JavaTranslator" rev="1.1.0" />
  • Now you can create Translator object and invoke translate() method
    Translator translator = Translator.getInstance();
    translator.translate("new a = 100; print(a);");
  • You can load program from InputStream
    translator.translate(Translator.loadProgram(new FileInputStream("example.txt")));
  • You can set your own OutputStream
    Translator.setOutputStream(new FileOutputStream(new File("out.txt")));