Repository navigation
FORTRAN Compiler v2.0 Release
I'm excited to announce the FORTRAN Compiler v2.0, a significant update to our tool for compiling a subset of the FORTRAN language using Flex and Bison. This release introduces new features, improved error handling, and expanded language support.
Highlights
- Lexical Analysis: Enhanced lexer for tokenizing FORTRAN keywords, identifiers, constants, and operators.
- Syntax Analysis: Improved parser with support for more complex FORTRAN constructs.
- New Features:
- Support for
CHARACTERandLOGICALdata types. PRINTstatements for output.- Logical and relational operators (
.AND.,.OR.,.NOT.,>,<,>=,<=,==,!=). - Arithmetic expressions with
+,-,*,/. - String handling with
CHARACTERandSTRING. - Logical constants (
.TRUE.,.FALSE.). - Enhanced
DOloops with step support. - Improved
IFstatements withELSEand nested conditions.
- Support for
- Error Handling: More informative error messages for syntax issues, such as unmatched parentheses, incorrect statement formats, or mismatched program names.
Installation
For setup instructions, refer to the Installation section in the README.
Usage
For usage details, follow the instructions in the Usage section of the README.
Known Issues
- Limited support for advanced FORTRAN constructs (e.g., arrays, derived types).
- Error handling for edge cases can be further improved.
Roadmap
Future versions will focus on:
- Expanding support for advanced FORTRAN features (e.g., arrays, derived types, modules).
- Enhancing error handling and performance.
- Adding support for file I/O operations.
What's New in v2.0?
-
Support for
CHARACTERandLOGICALData Types:- Declare and use
CHARACTERvariables with optional length specifications. - Use
LOGICALvariables and constants (.TRUE.,.FALSE.).
- Declare and use
-
PRINTStatements:- Output strings and expressions using
PRINT *syntax.
- Output strings and expressions using
-
Logical and Relational Operators:
- Support for
.AND.,.OR.,.NOT.,>,<,>=,<=,==, and!=.
- Support for
-
Enhanced
DOLoops:- Added support for step values in
DOloops.
- Added support for step values in
-
Improved Error Handling:
- More detailed error messages for syntax issues.
Example Code
Here’s an example of FORTRAN code that can now be compiled with v2.0:
PROGRAM Example
REAL :: x, y
INTEGER :: i
CHARACTER(LEN=10) :: name
LOGICAL :: flag
x = 10.5
y = 20.3
name = "FORTRAN"
flag = .TRUE.
PRINT *, "Hello, ", name
IF (x > y .AND. flag) THEN
PRINT *, "x is greater than y"
ELSE
PRINT *, "y is greater than or equal to x"
ENDIF
DO i = 1, 10, 2
PRINT *, "i = ", i
ENDDO
END PROGRAM ExampleHow to Upgrade
If you’re upgrading from v1.0, follow these steps:
-
Pull the latest changes from the repository:
git pull origin main
-
Rebuild the compiler:
./scripts/build.sh
-
Test the new features with your FORTRAN code.
Feedback and Contributions
We welcome your feedback and contributions! If you encounter any issues or have suggestions for new features, please open an issue or submit a pull request on GitHub.
Thank you for using the FORTRAN Compiler v2.0! We hope this release makes your FORTRAN programming experience even better. 🚀