“It’s not what we do once in a while that shapes our lives. It’s what we do consistently.” ― Anthony Robbins
Welcome everyone, this is your host Nikhil Maan aka Sc0rpi0n101 and this week I’ve tried to be more consistent with my schedule, work and communications with the Organization. I’ve taken a few small steps and plan to improve as I keep working.
- Consistency!?
- Merging the Pull Requests?
- The Fortran Parser using Codegen
- Things to be done
- What’s the plan now?
Consistency!?
With the classes finally starting, I have a full schedule for the classes and I can now create a schedule for myself. I can finally manage how I’m going to distribute the time between different tasks, what time I’ll dedicate to work and how much to playing and learning.
I’ll be in the University from 8:30 to 14:30 most of the days except Friday when it’ll be till 17:30. So, there should be plenty of time during the evening to work. I also get up early in the morning, so I might also be able to use that time to get some work done.
Merging the Pull Requests?
The Pull requests for the C parser and the Fortran Parser are almost ready to be merged. I have documented all the files and have prepared tests for both the parsers and both of them are passing all the tests. The only thing left to do is setting up Travis properly to get the pull requests tested on the environment, but it’s taking more time than expected. I’ve also created a third pull request for the Fortran Parser using SymPy’s Codegen AST.
The Fortran Parser using Codegen
The Parser using codegen AST can currently only have limited functionality due to some of the limitations in the development of LFortran and the Codegen AST. It supports Variable Declarations and Function Declarations. For those who want to understand the changes, let’s take the same node we discussed the last time: function declarations.
fn_args =[]
fn_body = []
fn_name = node.name
for arg_iter in node.args:
fn_args.append(
Variable(
arg_iter.name
)
)
for i in node.body:
fn_ast = call_visitor(i)
try:
fn_body_expr = fn_ast
except UnboundLocalError:
fn_body_expr = []
for sym in node.symtab.symbols:
decl = call_visitor(node.symtab.symbols[sym])
for symbols in decl:
fn_body.append(symbols)
for elem in fn_body_expr:
fn_body.append(elem)
fn_body.append(
Return(
Variable(
node.return_var.name
)
)
)
if isinstance(node.return_var.type, asr.Integer):
ret_type = IntBaseType(String('integer'))
elif isinstance(node.return_var.type, asr.Real):
ret_type = FloatBaseType(String('real'))
else:
raise NotImplementedError("Data type not supported")
new_node = FunctionDefinition(
return_type = ret_type,
name = fn_name,
parameters = fn_args,
body = fn_body
)
self.py_ast.append(new_node)
So, this time the new node is created using the FunctionDefinition Node from the Codegen AST instead of the Python AST node. The process of extracting return type, body and parameters are similar as they are still taken from the LFortran ASR.
It can be expended further upon the improvement of the LFortran ASR and the Codegen AST, which is one part of the plan going forward.
Things to be done
The Lfortran ASR currently lacks in some aspects which are to be developed in the coming days and have been documented in the following issues:
Sympy’s Codegen AST is also missing a few nodes, as documented in the issue #17182. These nodes are to be completed to implement new functionality to the parsers and mathematical functions for both the languages also need to be implemented.
I have also almost completed a revision for the LFortran Documentation, just some few functions are left to be tested. The improvements are looking good and I’ll get a merge request as soon as I’m done with the testing. You will be able to check out the improvements before the next blog.
What’s the Plan Now?
The plan, for now, is to find a way to get the dependencies installed in Travis and get the tests working. The next step for the parsers is to get some mathematical functions from both the languages implemented and start working on improving the Codegen AST and help with the LFortran ASR so that the parser can also progress further faster.
As for the meeting, it could not be held on regular time as the SciPy conference was going on. So, the meeting will be held after this blog is out. I will update about the meeting in the next blog.
Subscribe to the blog if you don’t want to miss any important updates