diff options
Diffstat (limited to 'code/FORTRAN2C')
-rw-r--r-- | code/FORTRAN2C/Makefile | 8 | ||||
-rw-r--r-- | code/FORTRAN2C/build/out.c | 6 | ||||
-rw-r--r-- | code/FORTRAN2C/examples/maths.txt | 1 | ||||
-rw-r--r-- | code/FORTRAN2C/examples/maths2.txt | 1 | ||||
-rw-r--r-- | code/FORTRAN2C/examples/maths3.txt | 1 | ||||
-rw-r--r-- | code/FORTRAN2C/examples/maths4.txt | 1 | ||||
-rw-r--r-- | code/FORTRAN2C/fortran2c.grammar | 35 | ||||
-rw-r--r-- | code/FORTRAN2C/fortran2c/CWriter.java | 26 | ||||
-rw-r--r-- | code/FORTRAN2C/fortran2c/Compiler.java | 28 | ||||
-rw-r--r-- | code/FORTRAN2C/fortran2c/Translation.java | 13 |
10 files changed, 0 insertions, 120 deletions
diff --git a/code/FORTRAN2C/Makefile b/code/FORTRAN2C/Makefile deleted file mode 100644 index 87610cf..0000000 --- a/code/FORTRAN2C/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: - java -jar ../../../sablecc-3.7/lib/sablecc.jar fortran2c.grammar - -clean: - rm -rfv fortran2c/analysis/ - rm -rfv fortran2c/lexer/ - rm -rfv fortran2c/node/ - rm -rvf fortran2c/parser/ diff --git a/code/FORTRAN2C/build/out.c b/code/FORTRAN2C/build/out.c deleted file mode 100644 index 47d2d58..0000000 --- a/code/FORTRAN2C/build/out.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -int main(int argc, char** argv) { - -}
\ No newline at end of file diff --git a/code/FORTRAN2C/examples/maths.txt b/code/FORTRAN2C/examples/maths.txt deleted file mode 100644 index 36726f5..0000000 --- a/code/FORTRAN2C/examples/maths.txt +++ /dev/null @@ -1 +0,0 @@ -(36/2 + 45.2) * 3
\ No newline at end of file diff --git a/code/FORTRAN2C/examples/maths2.txt b/code/FORTRAN2C/examples/maths2.txt deleted file mode 100644 index 313296b..0000000 --- a/code/FORTRAN2C/examples/maths2.txt +++ /dev/null @@ -1 +0,0 @@ -sin(45 * 2) / 3 diff --git a/code/FORTRAN2C/examples/maths3.txt b/code/FORTRAN2C/examples/maths3.txt deleted file mode 100644 index e092af1..0000000 --- a/code/FORTRAN2C/examples/maths3.txt +++ /dev/null @@ -1 +0,0 @@ -3-1+2
\ No newline at end of file diff --git a/code/FORTRAN2C/examples/maths4.txt b/code/FORTRAN2C/examples/maths4.txt deleted file mode 100644 index a922b77..0000000 --- a/code/FORTRAN2C/examples/maths4.txt +++ /dev/null @@ -1 +0,0 @@ -2 + 2 diff --git a/code/FORTRAN2C/fortran2c.grammar b/code/FORTRAN2C/fortran2c.grammar deleted file mode 100644 index 80bf2b7..0000000 --- a/code/FORTRAN2C/fortran2c.grammar +++ /dev/null @@ -1,35 +0,0 @@ -Package fortran2c; -Helpers - digit = ['0' .. '9']; -Tokens - number = digit+; - double = ((digit)+ '.' (digit)*) | ((digit)* '.' (digit)+); - plus = '+'; - minus = '-'; - mult = '*'; - div = '/'; - mod = '%'; - l_par = '('; - r_par = ')'; - sin = 'sin'; - blank = (' ' | 13 | 10)+; -Ignored Tokens - blank; -Productions - expr = - {factor} factor | - {plus} expr plus factor | - {minus} expr minus factor - ; - factor = - {term} term | - {mult} factor mult term | - {div} factor div term | - {mod} factor mod term - ; - term = - {number} number | - {double} double | - {expr} l_par expr r_par | - {sine} sin l_par expr r_par - ;
\ No newline at end of file diff --git a/code/FORTRAN2C/fortran2c/CWriter.java b/code/FORTRAN2C/fortran2c/CWriter.java deleted file mode 100644 index fec748a..0000000 --- a/code/FORTRAN2C/fortran2c/CWriter.java +++ /dev/null @@ -1,26 +0,0 @@ -package fortran2c; - -import java.io.*; -import java.util.HashSet; - -public class CWriter { - - private String filePath; - private File theFile; - private FileWriter theFileWriter; - private HashSet<String> functions; - - public CWriter(String filePath) throws IOException { - this.filePath = filePath; - File theFile = new File(filePath); - - if (theFile.createNewFile()) { - FileWriter theFileWriter = new FileWriter(filePath); - theFileWriter.write("#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char** argv) {\n}"); - theFileWriter.close(); - functions.add("main"); - } else { - throw new IOException("The file already exists"); - } - } -} diff --git a/code/FORTRAN2C/fortran2c/Compiler.java b/code/FORTRAN2C/fortran2c/Compiler.java deleted file mode 100644 index 7b124fa..0000000 --- a/code/FORTRAN2C/fortran2c/Compiler.java +++ /dev/null @@ -1,28 +0,0 @@ -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 diff --git a/code/FORTRAN2C/fortran2c/Translation.java b/code/FORTRAN2C/fortran2c/Translation.java deleted file mode 100644 index f5eeaba..0000000 --- a/code/FORTRAN2C/fortran2c/Translation.java +++ /dev/null @@ -1,13 +0,0 @@ -package fortran2c; -import fortran2c.analysis.*; -import fortran2c.node.*; - -class Translation extends DepthFirstAdapter -{ - - private CWriter writer; - - public Translation(CWriter writer) { - this.writer = writer; - } -} |