// A grammar for assembling archsim networks s = !ws (Statement +/ ws) !ws Statement = Import | Instance | Settings | Operations Settings = "settings" (Setting+/newline) /newline Setting = Name ^"=" quoted /ws Import = ^"import" JavaClassName "as" Type /ws JavaClassName = Name +/ "." Instance = ^"component" !ws ComponentName !ws ":" !ws Type (!newline Connection +/ newline)? Connection = Port ^"->" ForeignPort /ws | Port ^"<-" ForeignPort /ws ForeignPort = ComponentName ^"." Port Type = Name Port = Name ComponentName = Name Name = string:: [a-zA-Z0-9_]++ quoted = "\"" ~[\"]* "\"" newline = !ws "\n" !ws ws = [\r\n ]** | [\r\n ]** !Comment !ws Comment = "//" ~[\n]* "\n" | "/*" ~[\n]* "*/" Operations = ^"operations" (Operation+/newline) /newline Operation = ^"build_GASP_model" | ^"output" quoted /ws | ^"journal" quoted /ws | ^"error" quoted /ws | ^"info" quoted /ws | ^"run" [0-9]++ /ws | ^"step" [0-9]++ /ws | ^"self_check" | ^"reset" | ^"print_parameters" | ^"print_components" | ^"print_model" | ^"print_model_description"