# FortranCon 2021

23-24 September 2021
Virtual
Europe/Zurich timezone

## Finish AST generation in LFortran

24 Sep 2021, 17:20
5m
ZOOM (Virtual)

### ZOOM

#### Virtual

Fortran-lang Communications

### Speaker

Thirumalai Shaktivel (KS Institute Of Technology)

### Description

LFortran has a Bison based parser implemented in the parser.yy file that can parse most of Fortran source code. The main objective of my GSoC project was to make sure that all the grammar rules defined are exposed to AST (Abstract Syntax Tree) level i.e., one has to systematically go over the parser file and make sure AST is always generated for all the grammar rules defined, resulting in Completion of the AST generation. AST.asdl contains a list of AST nodes that have already been implemented, this project aims at adding the missing node into the AST.asdl.
The steps for implementation are:
Define macros, use them in the parser file to expose these nodes to the AST level.
Add tests to make sure things work as expected.
The fmt sub-command(format) is used to convert AST back to Fortran source code. There were certain issues related to fmt and parser, this project solved those issues. As a result, LFortran would be able to convert every grammar rule defined into AST for further manipulation and if required back to Fortran source code.

### Primary author

Thirumalai Shaktivel (KS Institute Of Technology)

### Co-author

Ondřej Čertík (Los Alamos National Laboratory)

### Presentation Materials

 FortranCon2021.pdf LFortran: Finish AST generation [Fortran-lang] [GSOC'21] video