?? isomod2.atg
字號:
VarDecl = IdList ":" (. Append(' : ') .)
Type .
ProcDecl = ProcHead ";" (. Append(';') .)
( (. IndentNextLine .)
ProcBlock Ident
| "FORWARD" (. Append(' FORWARD'); Indent .)
) .
ProcHead = "PROCEDURE" (. Append('PROCEDURE ') .)
Ident [ FormalParams ] .
FormalParams = "(" (. Append(' (') .)
[ FormalGroup { ";" (. Append('; ') .)
FormalGroup } ] ")" (. Append(')') .)
[ ":" (. Append(' : ') .)
QualId ] .
FormalGroup = [ "VAR" (. Append('VAR ') .)
] IdList ":" (. Append(' : ') .)
FormalType .
FormalType = [ "ARRAY" "OF" (. Append('ARRAY OF ') .)
] QualId .
ProcBlock = { Declaration }
[ InitialPart ]
"END" (. Append('END ') .) .
ModDecl = "MODULE" (. Append('MODULE ') .)
Ident
[ Priority ] ";" (. Append(';'); IndentNextLine .)
{ Import }
[ Export ]
ModBlock Ident .
StatSeq = Statement { WEAK ";" (. Append(';'); NewLine .)
Statement } .
Statement = SYNC [
Designator
( ":=" (. Append(' := ') .)
Expression
| [ ActualParams ]
)
| IfStat | CaseStat
| LoopStat | ForStat
| RepeatStat | WhileStat
| WithStat
| "EXIT" (. Append('EXIT') .)
| "RETRY" (. Append('RETRY') .)
| "RETURN" (. Append('RETURN') .)
[ (. Append(' ') .)
Expression ] ] .
WithStat = "WITH" (. Append('WITH ') .)
Designator "DO" (. Append(' DO'); IndentNextLine .)
StatSeq "END" (. ExdentNextLine; Append('END') .) .
LoopStat = "LOOP" (. Append('LOOP'); IndentNextLine .)
StatSeq
"END" (. ExdentNextLine; Append('END') .) .
ForStat = "FOR" (. Append('FOR ') .)
Ident ":=" (. Append(' := ') .)
Expression "TO" (. Append(' TO ') .)
Expression [ "BY" (. Append(' BY ') .)
ConstExpr ] "DO" (. Append(' DO'); IndentNextLine .)
StatSeq "END" (. ExdentNextLine; Append('END') .) .
RepeatStat = "REPEAT" (. Append('REPEAT'); IndentNextLine .)
StatSeq
"UNTIL" (. ExdentNextLine; Append('UNTIL ') .)
Expression .
WhileStat = "WHILE" (. Append('WHILE ') .)
Expression "DO" (. Append(' DO'); IndentNextLine .)
StatSeq "END" (. ExdentNextLine; Append('END') .) .
CaseStat = "CASE" (. Append('CASE ') .)
Expression "OF" (. Append(' OF'); IndentNextLine .)
OneCase { "|" (. Append('| ') .)
OneCase }
[ "ELSE" (. Append('ELSE '); Indent (* NewLine *) .)
StatSeq (. Exdent .)
] "END" (. ExdentNextLine; Append('END') .) .
OneCase = [ CaseLabList
":" (. Append(' : '); Indent (* NewLine *) .)
StatSeq (. ExdentNextLine .)
] .
(* Alternative
IfStat = "IF" (. Append('IF ') .)
Expression "THEN" (. IndentNextLine; Append('THEN '); Indent .)
StatSeq (. Exdent .)
{ "ELSIF" (. NewLine; Append('ELSIF ') .)
Expression "THEN" (. Append(' THEN '); Indent .)
StatSeq (. Exdent .)
}
[ "ELSE" (. NewLine; Append('ELSE '); Indent .)
StatSeq (. Exdent .)
] "END" (. ExdentNextLine; Append('END') .) .
*)
IfStat = "IF" (. Append('IF ') .)
Expression "THEN" (. IndentNextLine; Append('THEN'); IndentNextLine .)
StatSeq (. Exdent .)
{ "ELSIF" (. NewLine; Append('ELSIF ') .)
Expression "THEN" (. Append(' THEN'); IndentNextLine .)
StatSeq (. Exdent .)
}
[ "ELSE" (. NewLine; Append('ELSE'); IndentNextLine .)
StatSeq (. Exdent .)
] "END" (. ExdentNextLine; Append('END') .) .
Expression = SimExpr [ RelOp SimExpr SYNC ] .
SimExpr = SYNC [ "+" (. Append(' + ') .)
| "-" (. Append(' - ') .)
] Term { AddOp Term } .
Term = Factor { MulOp Factor } .
Factor = SYNC (
integer (. WriteToken .)
| real (. WriteToken .)
| string (. WriteToken .)
| SetRest
| Ident
{ SetRest
| "[" (. Append('[') .)
ExpList "]" (. Append(']') .)
| "^" (. Append('^') .)
| "." (. Append('.') .)
Ident
} [ ActualParams ]
| "(" (. Append('(') .)
Expression ")" (. Append(')') .)
| ( "NOT" (. Append('NOT ') .)
| "~" (. Append('~ ') .)
) Factor
) .
ActualParams = "(" (. Append('(') .)
[ ExpList ] ")" (. Append(')') .) .
SetRest = "{" (. Append('{') .)
[ Element { "," (. Append(', ') .)
Element } ] "}" (. Append('}') .) .
Element = ConstExpr
[ ".." (. Append(' .. ') .)
ConstExpr ] .
MulOp = "*" (. Append(' * ') .)
| "/" (. Append(' * ') .)
| "DIV" (. Append(' DIV ') .)
| "REM" (. Append(' REM ') .)
| "MOD" (. Append(' MOD ') .)
| "AND" (. Append(' AND ') .)
| "&" (. Append(' & ') .) .
AddOp = "+" (. Append(' + ') .)
| "-" (. Append(' - ') .)
| "OR" (. Append(' OR ') .) .
RelOp = "=" (. Append(' = ') .)
| "#" (. Append(' # ') .)
| "<>" (. Append(' <> ') .)
| "<" (. Append(' < ') .)
| "<=" (. Append(' <= ') .)
| ">" (. Append(' > ') .)
| ">=" (. Append(' >= ') .)
| "IN" (. Append(' IN ') .) .
Designator = Ident { "[" (. Append('[') .)
ExpList "]" (. Append(']') .)
| "^" (. Append('^') .)
| "." (. Append('.') .)
Ident } .
IdList = Ident { "," (. Append(', ') .)
Ident } .
ExpList = Expression { "," (. Append(', ') .)
Expression } .
QualId = Ident { "." (. Append('.') .)
Ident } .
Ident = identifier (. WriteToken .) .
END Mod2.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -