Syntactic sugar for FORTRAN afficionados. (Proof of concept)
Project description
Fortiori
A proof of concept for adding syntactic sugar to FORTRAN. The goal of fortiori is to provide a friendlier syntax for FORTRAN enthusiasts while still producing mostly-compliant FORTRAN code which can then be compiled normally using gfortran and the like.
Supported Features
- Declaration of function return types in caller
- Case-sensitive identifiers
- Automatically add 'implicit none'
- Return statement with value
- Import/multi-file support
- Convert void functions to subroutines
- If-else conditional blocks
- Do loops with inline variable declaration
Example (WIP)
integer function getFirstPrime(integer::lower, integer::higher) {
return 5;
}
program {
print*, "Getting a prime...";
integer::Prime = getFirstPrime(1,10);
integer::PRIME = 10;
if (PRIME == 10) {
print*, "condition is true";
} else {
print*, "condition is false";
}
do integer::n = 1,10 {
print*, n;
}
do while ( n < 15) {
print*, n, "incrementing...";
n = n+1;
}
print*, "This is a prime:", Prime;
print*, "This is another prime:", PRIME;
}
This would yield the following FORTRAN code
integer function getf$irstp$rime(lower,higher)
implicit none;
integer::lower
integer::higher
getf$irstp$rime = 5;
return;
end function;
program main
implicit none;
integer::getf$irstp$rime;
integer::p$rime;
integer::p$$rime$$;
integer::n;
print*, "Getting a prime...";
p$rime = getf$irstp$rime(1,10);
p$$rime$$ = 10;
if (p$$rime$$ == 10) then
print*, "condition is true";
else
print*, "condition is false";
end if;
do n = 1,10
print*, n;
end do;
do while ( n < 15)
print*, n, "incrementing...";
n = n+1;
end do;
print*, "This is a prime:", p$rime;
print*, "This is another prime:", p$$rime$$;
end program;⏎
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fortiori-0.0.0.tar.gz
(7.8 kB
view details)
File details
Details for the file fortiori-0.0.0.tar.gz
.
File metadata
- Download URL: fortiori-0.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79be05b057c8aeeed5cd4d730d42fb8b90a7aad2907477460e484e744915d5aa |
|
MD5 | 050d80a91ceead133037550152c155f8 |
|
BLAKE2b-256 | c26d24603adb9f85e533f6744eb89bc3209e23fb01cc45d84aaf8c3a8bdd85de |