diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-01 14:51:47 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-11-01 14:51:47 +0000 |
commit | 85e2726ddedd2981425c5ac07f7257bce1a6ddbf (patch) | |
tree | d84a75438cba4fd3d7180c776f3632577292433a /code/FORTRAN2C/fortran2c/Compiler.java | |
parent | 69b0ad07bac30beca1397ff187468e7597203c44 (diff) | |
download | esotericFORTRAN-85e2726ddedd2981425c5ac07f7257bce1a6ddbf.tar.gz esotericFORTRAN-85e2726ddedd2981425c5ac07f7257bce1a6ddbf.zip |
started work on translation to c
Diffstat (limited to 'code/FORTRAN2C/fortran2c/Compiler.java')
-rw-r--r-- | code/FORTRAN2C/fortran2c/Compiler.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/code/FORTRAN2C/fortran2c/Compiler.java b/code/FORTRAN2C/fortran2c/Compiler.java new file mode 100644 index 0000000..7b124fa --- /dev/null +++ b/code/FORTRAN2C/fortran2c/Compiler.java @@ -0,0 +1,28 @@ +package fortran2c; +import fortran2c.parser.*; +import fortran2c.lexer.*; +import fortran2c.node.*; +import java.io.*; + +public class Compiler +{ + public static void main(String[] args) + { + try + { + System.out.println("Using source file: " + args[0]); + // Create a Parser instance. + Parser p = new Parser(new Lexer(new PushbackReader(new InputStreamReader(new FileInputStream(args[0])), 1024))); + // Parse the input. + Start tree = p.parse(); + // Apply the translation. + CWriter cWriter = new CWriter("build/out.c"); + + tree.apply(new Translation(cWriter)); + } + catch(Exception e) + { + System.out.println(e.getMessage()); + } + } +}
\ No newline at end of file |