1 // A grammar for assembling archsim networks
3 s = !ws (Statement +/ ws) !ws
5 Statement = Import | Instance | Settings | Operations
7 Settings = "settings" (Setting+/newline) /newline
8 Setting = Name ^"=" quoted /ws
10 Import = ^"import" JavaClassName "as" Type /ws
11 JavaClassName = Name +/ "."
13 Instance = ^"component" !ws ComponentName !ws ":" !ws Type (!newline Connection +/ newline)?
15 Connection = Port ^"->" ForeignPort /ws
16 | Port ^"<-" ForeignPort /ws
18 ForeignPort = ComponentName ^"." Port
23 Name = string:: [a-zA-Z0-9_]++
25 quoted = "\"" ~[\"]* "\""
26 newline = !ws "\n" !ws
28 | [\r\n ]** !Comment !ws
29 Comment = "//" ~[\n]* "\n"
32 Operations = ^"operations" (Operation+/newline) /newline
33 Operation = ^"build_GASP_model"
34 | ^"output" quoted /ws
35 | ^"journal" quoted /ws
45 | ^"print_model_description"