From 13c44054b21d26782e98a52e9a114250ab8307ff Mon Sep 17 00:00:00 2001
From: AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>
Date: Thu, 9 Dec 2021 02:30:57 +0000
Subject: Added example program of each main feature
---
src/IDE/IDE/HelloApplication.java | 25 --------------------
src/IDE/IDE/HelloController.java | 14 ------------
src/IDE/IDE/hello-view.fxml | 16 -------------
src/IDE/Makefile | 5 ----
src/IDE/readme.md | 19 ----------------
src/examples/array.ft | 13 +++++++++++
src/examples/conditional.ft | 11 +++++++++
src/examples/doStatement.ft | 6 +++++
src/examples/doWhileStatement.ft | 8 +++++++
src/examples/example.ft | 18 ---------------
src/examples/expression.ft | 5 ++++
src/examples/function.ft | 18 +++++++++++++++
src/examples/iteration.ft | 8 -------
src/examples/selection.ft | 6 -----
src/examples/sieve.ft | 48 +++++++++++++++++++++++++++++++++++++++
src/examples/string.ft | 5 ++++
src/examples/subroutine.ft | 9 ++++++++
17 files changed, 123 insertions(+), 111 deletions(-)
delete mode 100644 src/IDE/IDE/HelloApplication.java
delete mode 100644 src/IDE/IDE/HelloController.java
delete mode 100644 src/IDE/IDE/hello-view.fxml
delete mode 100644 src/IDE/Makefile
delete mode 100644 src/IDE/readme.md
create mode 100644 src/examples/array.ft
create mode 100644 src/examples/conditional.ft
create mode 100644 src/examples/doStatement.ft
create mode 100644 src/examples/doWhileStatement.ft
delete mode 100644 src/examples/example.ft
create mode 100644 src/examples/expression.ft
create mode 100644 src/examples/function.ft
delete mode 100644 src/examples/iteration.ft
delete mode 100644 src/examples/selection.ft
create mode 100644 src/examples/sieve.ft
create mode 100644 src/examples/string.ft
create mode 100644 src/examples/subroutine.ft
diff --git a/src/IDE/IDE/HelloApplication.java b/src/IDE/IDE/HelloApplication.java
deleted file mode 100644
index aaa728f..0000000
--- a/src/IDE/IDE/HelloApplication.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package IDE;
-
-import javafx.application.Application;
-import javafx.fxml.FXMLLoader;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import java.io.File;
-import javafx.scene.Parent;
-
-import java.io.IOException;
-
-public class HelloApplication extends Application {
- @Override
- public void start(Stage stage) throws IOException {
- Parent root = FXMLLoader.load(getClass().getResource("hello-view.fxml"));
- Scene scene = new Scene(root, 320, 240);
- stage.setTitle("Hello!");
- stage.setScene(scene);
- stage.show();
- }
-
- public static void main(String[] args) {
- launch();
- }
-}
\ No newline at end of file
diff --git a/src/IDE/IDE/HelloController.java b/src/IDE/IDE/HelloController.java
deleted file mode 100644
index 877e5ba..0000000
--- a/src/IDE/IDE/HelloController.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package IDE;
-
-import javafx.fxml.FXML;
-import javafx.scene.control.Label;
-
-public class HelloController {
- @FXML
- private Label welcomeText;
-
- @FXML
- protected void onHelloButtonClick() {
- welcomeText.setText("Welcome to the FORTRAN compiler application!");
- }
-}
\ No newline at end of file
diff --git a/src/IDE/IDE/hello-view.fxml b/src/IDE/IDE/hello-view.fxml
deleted file mode 100644
index c31d9e2..0000000
--- a/src/IDE/IDE/hello-view.fxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/IDE/Makefile b/src/IDE/Makefile
deleted file mode 100644
index 127db02..0000000
--- a/src/IDE/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-all:
- javac --module-path ../../../javafx-sdk-17.0.1/lib/ --add-modules javafx.controls,javafx.fxml ./IDE/*.java
-
-clean:
- rm -vf IDE/*.class
diff --git a/src/IDE/readme.md b/src/IDE/readme.md
deleted file mode 100644
index 0dc9faa..0000000
--- a/src/IDE/readme.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# esotericFORTRAN IDE
-
-## Setting Up
-
-Install FXML from [here](https://gluonhq.com/products/javafx/) and extract it in the directory behind `EsotericProject`
-
-## Running
-
-To compile, simply run `make`. Then to run:
-
-`java --module-path ..\..\..\javafx-sdk-17.0.1\lib\ --add-modules javafx.controls,javafx.fxml IDE.HelloApplication`
-
-## Editors?
-
-If you got intellisense and stuff to work in vscodium, well done, coz I couldn't do that :3
-
-### IntelliJ
-
-I hate IntelliJ but its the only way I could get a working intellisense. Right click on this folder and select 'Open Folder as an IntelliJ IDEA Community Edition Project', then follow [this](https://openjfx.io/openjfx-docs/#install-javafx) guide (select 'JavaFX and IntelliJ' in the website sidebar).
\ No newline at end of file
diff --git a/src/examples/array.ft b/src/examples/array.ft
new file mode 100644
index 0000000..6f62940
--- /dev/null
+++ b/src/examples/array.ft
@@ -0,0 +1,13 @@
+program array
+int dimension(10)::a
+int::i
+
+do i=0,9
+a(i)=i*2
+end do
+
+do i=0,9
+print*,a(i)
+end do
+
+end program array
\ No newline at end of file
diff --git a/src/examples/conditional.ft b/src/examples/conditional.ft
new file mode 100644
index 0000000..6d3f79d
--- /dev/null
+++ b/src/examples/conditional.ft
@@ -0,0 +1,11 @@
+program conditional
+int::a
+int::b
+a=5
+b=7
+if a>=b then
+print*,a," is greater than or equal to ",b
+else
+print*,a," is less than ",b
+end if
+end program conditional
\ No newline at end of file
diff --git a/src/examples/doStatement.ft b/src/examples/doStatement.ft
new file mode 100644
index 0000000..ddee000
--- /dev/null
+++ b/src/examples/doStatement.ft
@@ -0,0 +1,6 @@
+program doStatement
+int::i
+do i=0,10
+print*,i
+end do
+end program doStatement
\ No newline at end of file
diff --git a/src/examples/doWhileStatement.ft b/src/examples/doWhileStatement.ft
new file mode 100644
index 0000000..a8aa096
--- /dev/null
+++ b/src/examples/doWhileStatement.ft
@@ -0,0 +1,8 @@
+program doWhileStatement
+int::i
+i=0
+do while(i<=10)
+print*,i
+i=i+1
+end do
+end program doWhileStatement
\ No newline at end of file
diff --git a/src/examples/example.ft b/src/examples/example.ft
deleted file mode 100644
index 571cace..0000000
--- a/src/examples/example.ft
+++ /dev/null
@@ -1,18 +0,0 @@
-program example
-real::a
-real::root
-a=30
-root=sqrt(25+5)
-print*,"The square root of ",a," is ",root
-end program example
-
-!Function to calculate the square root of a value
-function real sqrt(real value)
-real::result
-result=1
-int::count
-do count=0,10
-result =(result+value/result)/2
-end do
-return result
-end
\ No newline at end of file
diff --git a/src/examples/expression.ft b/src/examples/expression.ft
new file mode 100644
index 0000000..c3420fe
--- /dev/null
+++ b/src/examples/expression.ft
@@ -0,0 +1,5 @@
+program expression
+int::a
+a=(5+4)*(10/2)+5**2
+print*,a
+end program expression
\ No newline at end of file
diff --git a/src/examples/function.ft b/src/examples/function.ft
new file mode 100644
index 0000000..2c6ed7d
--- /dev/null
+++ b/src/examples/function.ft
@@ -0,0 +1,18 @@
+program example
+real::a
+real::root
+a=30
+root=sqrt(a)
+print*,"The square root of ",a," is ",root
+end program example
+
+!Function to calculate the square root of a value
+function real sqrt(real value)
+real::result
+result=1
+int::count
+do count=0,10
+result =(result+value/result)/2
+end do
+return result
+end
\ No newline at end of file
diff --git a/src/examples/iteration.ft b/src/examples/iteration.ft
deleted file mode 100644
index 22a2bfb..0000000
--- a/src/examples/iteration.ft
+++ /dev/null
@@ -1,8 +0,0 @@
-int dimension(5)::test
-int::i
-do i=0,4
-test(i)=i
-end do
-do i=0,4
-print*,test(i)
-end do
\ No newline at end of file
diff --git a/src/examples/selection.ft b/src/examples/selection.ft
deleted file mode 100644
index 21100b2..0000000
--- a/src/examples/selection.ft
+++ /dev/null
@@ -1,6 +0,0 @@
-character (len=10)::hello
-hello="hello"
-if 4==5 then
-hello="goodbye "
-endif
-print *,hello,6," world" endprint
\ No newline at end of file
diff --git a/src/examples/sieve.ft b/src/examples/sieve.ft
new file mode 100644
index 0000000..e771009
--- /dev/null
+++ b/src/examples/sieve.ft
@@ -0,0 +1,48 @@
+!Program to calculate all primes below a certain value
+program sieveOfEratosthenes
+
+ !define variables
+ int::n
+ n=10000
+ int dimension(10000)::checks
+ int::i
+ int::j
+
+ !initialise array
+ do i=2,n
+ checks(i)=1
+ end do
+ i=2
+
+ !search for primes
+ do while(i