jupyter 笔记本中的 lfortran 会杀死内核

Mit*_*ops 9 fortran jupyter-notebook jupyter-kernel

我似乎无法从lfortran jupyter kernel获得输出。

我通过 conda install 安装了:

  - lfortran
  - jupyter
Run Code Online (Sandbox Code Playgroud)

我可以运行jupyter并选择 lfortran 内核。然而:

Hello World 不执行任何操作

我没有看到 hello world,也没有看到错误。

如果在第二个单元格中我调用new它会使内核崩溃。

awv*_*wgk 11

LFortran 中的全局作用域专门用于在笔记本中启用交互性和使用,并定义了一组附加规则。实际上,您不需要program主体来运行任何 Fortran 代码,只需直接使用 print 语句即可:

print *, "Hello world!"
Run Code Online (Sandbox Code Playgroud)

此处描述了可用的 Fortran 扩展

此外, aprogram本身不应该是可调用的,而是应该在声明后直接执行(这可能是 LFortran 中的错误,在lfortran#648中报告)。相反,您可能想声明subroutine

subroutine new
  print *, "Hello world!"
end subroutine new
Run Code Online (Sandbox Code Playgroud)

然后运行它

call new
Run Code Online (Sandbox Code Playgroud)