Skip to content

Commit a332e5d

Browse files
author
rasmussn
committed
Changes to try and improve the performance of the fixed to free conversion.
1 parent 46422af commit a332e5d

2 files changed

Lines changed: 84 additions & 43 deletions

File tree

fortran/syntax/FixedForm.rtg

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,66 @@
1+
12
regular tree grammar
23
start File
34
productions
4-
ListStarOfLine0 -> ListPlusOfLine0
5-
ListStarOfLine0 -> <nil>()
6-
ListStarOfLine0 -> <conc>(ListStarOfLine0,ListStarOfLine0)
7-
ListPlusOfLine0 -> <conc>(ListStarOfLine0,ListPlusOfLine0)
8-
ListPlusOfLine0 -> <conc>(ListPlusOfLine0,ListStarOfLine0)
9-
ListPlusOfLine0 -> <conc>(ListPlusOfLine0,ListPlusOfLine0)
10-
ListPlusOfLine0 -> <cons>(Line,ListStarOfLine0)
11-
OptWS -> no-ws()
12-
OptWS -> ws(WS)
13-
StartChar -> stchar(STARTCHAR)
14-
PreChar -> prechar(PRECHAR)
15-
ContChar -> conchar(CONTCHAR)
16-
CommentChar -> comchar(COMMENTCHAR)
17-
BangChar -> comchar(BANGCHAR)
18-
Eol -> eol(EOL)
19-
Line -> Continuation(START,ContChar,CHARS,Eol)
20-
Line -> LabeledStmt(LABEL,StartChar,CHARS,Eol)
21-
Line -> Stmt(START,StartChar,CHARS,Eol)
22-
Line -> FreeFormComment(WS,BangChar,CHARS,Eol)
23-
Line -> Comment(CommentChar,CHARS,Eol)
24-
Line -> Preprocess(PreChar,CHARS,Eol)
25-
Line -> BlankLine(OptWS,Eol)
26-
File -> File(ListStarOfLine0)
27-
LABEL -> <string>
28-
START -> <string>
29-
CONTCHAR -> <string>
30-
STARTCHAR -> <string>
31-
COMMENTCHAR -> <string>
32-
PRECHAR -> <string>
33-
BANGCHAR -> <string>
34-
CHARS -> <string>
35-
LETTER -> <string>
36-
DIGIT -> <string>
37-
WS -> <string>
38-
EOL -> <string>
5+
ListStarOfFollowLine0 -> ListPlusOfFollowLine0
6+
ListStarOfFollowLine0 -> <nil>()
7+
ListStarOfFollowLine0 -> <conc>(ListStarOfFollowLine0,ListStarOfFollowLine0)
8+
ListPlusOfFollowLine0 -> <conc>(ListStarOfFollowLine0,ListPlusOfFollowLine0)
9+
ListPlusOfFollowLine0 -> <conc>(ListPlusOfFollowLine0,ListStarOfFollowLine0)
10+
ListPlusOfFollowLine0 -> <conc>(ListPlusOfFollowLine0,ListPlusOfFollowLine0)
11+
ListPlusOfFollowLine0 -> <cons>(FollowLine,ListStarOfFollowLine0)
12+
ListStarOfStmtBlock0 -> ListPlusOfStmtBlock0
13+
ListStarOfStmtBlock0 -> <nil>()
14+
ListStarOfStmtBlock0 -> <conc>(ListStarOfStmtBlock0,ListStarOfStmtBlock0)
15+
ListPlusOfStmtBlock0 -> <conc>(ListStarOfStmtBlock0,ListPlusOfStmtBlock0)
16+
ListPlusOfStmtBlock0 -> <conc>(ListPlusOfStmtBlock0,ListStarOfStmtBlock0)
17+
ListPlusOfStmtBlock0 -> <conc>(ListPlusOfStmtBlock0,ListPlusOfStmtBlock0)
18+
ListPlusOfStmtBlock0 -> <cons>(StmtBlock,ListStarOfStmtBlock0)
19+
ListStarOfInitialComment0 -> ListPlusOfInitialComment0
20+
ListStarOfInitialComment0 -> <nil>()
21+
ListStarOfInitialComment0 -> <conc>(ListStarOfInitialComment0,ListStarOfInitialComment0)
22+
ListPlusOfInitialComment0 -> <conc>(ListStarOfInitialComment0,ListPlusOfInitialComment0)
23+
ListPlusOfInitialComment0 -> <conc>(ListPlusOfInitialComment0,ListStarOfInitialComment0)
24+
ListPlusOfInitialComment0 -> <conc>(ListPlusOfInitialComment0,ListPlusOfInitialComment0)
25+
ListPlusOfInitialComment0 -> <cons>(InitialComment,ListStarOfInitialComment0)
26+
OptWS -> no-ws()
27+
OptWS -> ws(WS)
28+
NoChar -> no-char()
29+
StartChar -> stchar(STARTCHAR)
30+
PreChar -> prechar(PRECHAR)
31+
ContChar -> conchar(CONTCHAR)
32+
CommentChar -> comchar(COMMENTCHAR)
33+
BangChar -> comchar(BANGCHAR)
34+
Eol -> eol(EOL)
35+
StmtBlock -> StmtBlock(Stmt,ListStarOfFollowLine0)
36+
Stmt -> LabeledStmt(LABELTAB,NoChar,CHARS,Eol)
37+
Stmt -> LabeledStmt(LABEL,StartChar,CHARS,Eol)
38+
Stmt -> Stmt(TABSTART,NoChar,CHARS,Eol)
39+
Stmt -> Stmt(START,StartChar,CHARS,Eol)
40+
Continuation -> Continuation(START,ContChar,CHARS,Eol)
41+
CommentLine -> FreeFormComment(WS,BangChar,CHARS,Eol)
42+
CommentLine -> Comment(CommentChar,CHARS,Eol)
43+
BlankLine -> BlankLine(OptWS,Eol)
44+
PreprocessLine -> Preprocess(PreChar,CHARS,Eol)
45+
FollowLine -> PreprocessLine
46+
FollowLine -> Continuation
47+
FollowLine -> CommentLine
48+
FollowLine -> BlankLine
49+
InitialComment -> PreprocessLine
50+
InitialComment -> CommentLine
51+
InitialComment -> BlankLine
52+
File -> File(ListStarOfInitialComment0,ListStarOfStmtBlock0)
53+
LABELTAB -> <string>
54+
LABEL -> <string>
55+
START -> <string>
56+
TABSTART -> <string>
57+
CONTCHAR -> <string>
58+
STARTCHAR -> <string>
59+
COMMENTCHAR -> <string>
60+
PRECHAR -> <string>
61+
BANGCHAR -> <string>
62+
CHARS -> <string>
63+
LETTER -> <string>
64+
DIGIT -> <string>
65+
WS -> <string>
66+
EOL -> <string>

fortran/syntax/FixedForm.str

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,35 @@ signature
44
constructors
55
no-ws : OptWS
66
ws : WS -> OptWS
7+
no-char : NoChar
78
stchar : STARTCHAR -> StartChar
89
prechar : PRECHAR -> PreChar
910
conchar : CONTCHAR -> ContChar
1011
comchar : COMMENTCHAR -> CommentChar
1112
comchar : BANGCHAR -> BangChar
1213
eol : EOL -> Eol
13-
Continuation : START * ContChar * CHARS * Eol -> Line
14-
LabeledStmt : LABEL * StartChar * CHARS * Eol -> Line
15-
Stmt : START * StartChar * CHARS * Eol -> Line
16-
FreeFormComment : WS * BangChar * CHARS * Eol -> Line
17-
Comment : CommentChar * CHARS * Eol -> Line
18-
Preprocess : PreChar * CHARS * Eol -> Line
19-
BlankLine : OptWS * Eol -> Line
20-
File : List(Line) -> File
14+
StmtBlock : Stmt * List(FollowLine) -> StmtBlock
15+
LabeledStmt : LABELTAB * NoChar * CHARS * Eol -> Stmt
16+
LabeledStmt : LABEL * StartChar * CHARS * Eol -> Stmt
17+
Stmt : TABSTART * NoChar * CHARS * Eol -> Stmt
18+
Stmt : START * StartChar * CHARS * Eol -> Stmt
19+
Continuation : START * ContChar * CHARS * Eol -> Continuation
20+
FreeFormComment : WS * BangChar * CHARS * Eol -> CommentLine
21+
Comment : CommentChar * CHARS * Eol -> CommentLine
22+
BlankLine : OptWS * Eol -> BlankLine
23+
Preprocess : PreChar * CHARS * Eol -> PreprocessLine
24+
: PreprocessLine -> FollowLine
25+
: Continuation -> FollowLine
26+
: CommentLine -> FollowLine
27+
: BlankLine -> FollowLine
28+
: PreprocessLine -> InitialComment
29+
: CommentLine -> InitialComment
30+
: BlankLine -> InitialComment
31+
File : List(InitialComment) * List(StmtBlock) -> File
32+
: String -> LABELTAB
2133
: String -> LABEL
2234
: String -> START
35+
: String -> TABSTART
2336
: String -> CONTCHAR
2437
: String -> STARTCHAR
2538
: String -> COMMENTCHAR

0 commit comments

Comments
 (0)