FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Initial commit · Mu-L/lpython@a7a9a76 · GitHub

/ lpython Public
forked from lcompilers/lpython

Commit a7a9a76

Browse files
committed
Initial commit
0 parents  commit a7a9a76

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

‎build.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
antlr4="java org.antlr.v4.Tool"
7+
grun="java org.antlr.v4.gui.TestRig"
8+
9+
$antlr4 fortran.g4
10+
javac fortran*.java
11+
12+
# Test:
13+
$grun fortran module -tree examples/m1.f90

‎examples/m1.f90‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module m1
2+
implicit none
3+
private
4+
public sp, dp, hp
5+
6+
7+
end module

‎fortran.g4‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
grammar fortran;
2+
3+
module
4+
: 'module' IDENT 'implicit none' private_decl? public_decl? 'end' IDENT?
5+
;
6+
7+
private_decl
8+
: 'private'
9+
;
10+
11+
public_decl
12+
: 'public' IDENT (',' IDENT)*
13+
;
14+
15+
IDENT
16+
: ('a' .. 'z' | 'A' .. 'Z') ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_')*
17+
;
18+
19+
WS
20+
: [ \t\r\n] -> skip
21+
;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL