Skip to content

Commit

Permalink
one-slide-DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Jul 17, 2012
1 parent 6aa5d57 commit 432c4d0
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 0 deletions.
7 changes: 7 additions & 0 deletions topics/implementation/busses/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions topics/implementation/busses/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin
.settings
52 changes: 52 additions & 0 deletions topics/implementation/busses/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>busses</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>rascal_eclipse.rascal_builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>rascal_eclipse.term_builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>rascal_eclipse.rascal_nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>rascal_eclipse.term_nature</nature>
</natures>
<linkedResources>
<link>
<name>eclipse</name>
<type>2</type>
<locationURI>rascal-library://eclipse</locationURI>
</link>
<link>
<name>std</name>
<type>2</type>
<locationURI>rascal-library://rascal</locationURI>
</link>
</linkedResources>
</projectDescription>
13 changes: 13 additions & 0 deletions topics/implementation/busses/Koblenz.bus
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
3 : Overbergplatz, Eduard-M�ller-Stra�e, In der Goldgrube, Lindenstra�e, Br�derhaus, Roonstra�e, Christuskirche,
L�hr-Center, Ludwig-Erhard-Stra�e, Peter-Kl�ckner-Stra�e, Verwaltungszentrum, Kurt-Schumacher-Br�cke, Winninger Stra�e.

5 : Hauptbahnhof, Christuskirche, Zentralplatz, L�hr-Center, Balduinbr�cke, Sch�llerplatz, An der Ringmauer,
Langemarckplatz, Johannesstra�e, Bubenheimer Weg, Closterbrauerei, R�benacher Stra�e, Im Acker, Sportplatz,
Kirmesplatz, Raiffaisenstra�e, Am Alten Sch�tenplatz, Eulenhorst, Oberweiher, Uni.

15 : Hauptbahnhof, Christuskirche, Zentralplatz, L�hr-Center, Balduinbr�cke, Sch�llerplatz, An der Ringmauer,
Langemarckplatz, Johannesstra�e, Bubenheimer Weg, Closterbrauerei, In der Wegl�nge, Trifter Weg, Pfaffengasse,
Bienenst�ck.

20 : Hauptbahnhof, Christuskirche, L�hr-Center, Saarplatz, Franz-Weis-Stra�e, St-Elisabeth-Kirche, Bl�cherstra�e,
Marienhof, Verwaltungszentrum, Kurt-Schumacher-Br�cke, Winninger Stra�e, Oberweiher.
49 changes: 49 additions & 0 deletions topics/implementation/busses/Koblenz.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
digraph Metro { node [shape=box]

"Peter-Kl&ouml;ckner-Stra&szlig;e" -> "Verwaltungszentrum"
"Langemarckplatz" -> "Johannesstra&szlig;e"
"R&uuml;benacher Stra&szlig;e" -> "Im Acker"
"Eduard-M&uuml;ller-Stra&szlig;e" -> "In der Goldgrube"
"Bl&uuml;cherstra&szlig;e" -> "Marienhof"
"Am Alten Sch&uuml;tenplatz" -> "Eulenhorst"
"Closterbrauerei" -> "R&uuml;benacher Stra&szlig;e"
"Balduinbr&uuml;cke" -> "Sch&uuml;llerplatz"
"Johannesstra&szlig;e" -> "Bubenheimer Weg"
"Saarplatz" -> "Franz-Weis-Stra&szlig;e"
"Kirmesplatz" -> "Raiffaisenstra&szlig;e"
"Br&uuml;derhaus" -> "Roonstra&szlig;e"
"St-Elisabeth-Kirche" -> "Bl&uuml;cherstra&szlig;e"
"Pfaffengasse" -> "Bienenst&uuml;ck"
"Franz-Weis-Stra&szlig;e" -> "St-Elisabeth-Kirche"
"Hauptbahnhof" -> "Christuskirche"
"Lindenstra&szlig;e" -> "Br&uuml;derhaus"
"Kurt-Schumacher-Br&uuml;cke" -> "Winninger Stra&szlig;e"
"Oberweiher" -> "Uni"
"Sportplatz" -> "Kirmesplatz"
"Closterbrauerei" -> "In der Wegl&auml;nge"
"Sch&uuml;llerplatz" -> "An der Ringmauer"
"Trifter Weg" -> "Pfaffengasse"
"Christuskirche" -> "Zentralplatz"
"An der Ringmauer" -> "Langemarckplatz"
"Roonstra&szlig;e" -> "Christuskirche"
"Bubenheimer Weg" -> "Closterbrauerei"
"L&ouml;hr-Center" -> "Ludwig-Erhard-Stra&szlig;e"
"Winninger Stra&szlig;e" -> "Oberweiher"
"In der Wegl&auml;nge" -> "Trifter Weg"
"Marienhof" -> "Verwaltungszentrum"
"L&ouml;hr-Center" -> "Saarplatz"
"Im Acker" -> "Sportplatz"
"Verwaltungszentrum" -> "Kurt-Schumacher-Br&uuml;cke"
"Christuskirche" -> "L&ouml;hr-Center"
"L&ouml;hr-Center" -> "Balduinbr&uuml;cke"
"Eulenhorst" -> "Oberweiher"
"Zentralplatz" -> "L&ouml;hr-Center"
"Overbergplatz" -> "Eduard-M&uuml;ller-Stra&szlig;e"
"Raiffaisenstra&szlig;e" -> "Am Alten Sch&uuml;tenplatz"
"Ludwig-Erhard-Stra&szlig;e" -> "Peter-Kl&ouml;ckner-Stra&szlig;e"
"In der Goldgrube" -> "Lindenstra&szlig;e"

"Closterbrauerei" [shape=ellipse]
"L&ouml;hr-Center" [shape=ellipse]
"Christuskirche" [shape=ellipse]
}
Binary file added topics/implementation/busses/Koblenz.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions topics/implementation/busses/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: busses
Bundle-SymbolicName: busses
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.imp.pdb.values,
rascal
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
8 changes: 8 additions & 0 deletions topics/implementation/busses/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
all:
dot -Tpdf Koblenz.dot > Koblenz.pdf

curate:
perl -pi -w -e 's/ä/&auml;/g;' Koblenz.dot
perl -pi -w -e 's/ü/&uuml;/g;' Koblenz.dot
perl -pi -w -e 's/ö/&ouml;/g;' Koblenz.dot
perl -pi -w -e 's/ß/&szlig;/g;' Koblenz.dot
1 change: 1 addition & 0 deletions topics/implementation/busses/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = META-INF/
39 changes: 39 additions & 0 deletions topics/implementation/busses/src/Busses.rsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@contributor{Jurgen Vinju - Jurgen.Vinju@cwi.nl - SWAT, CWI}
@contributor{Vadim Zaytsev - vadim@grammarware.net - SWAT, CWI}
module Busses

import IO;
import Set;
import String;
import ParseTree;

start syntax System = Line+;
syntax Line = Num ":" {Id ","}+ "." ;
layout WS = [\ \t\n\r]* !>> [\ \t\n\r];
lexical Id = [A-Za-z][A-Za-zŸŠš\-\ ]+[A-Za-z] !>> [A-Za-z];
lexical Num = [0-9]+ !>> [0-9];

rel[Id,Id] extractGraph(loc source) =
{<from,to> | /Line b := parse(#start[System],source), (Line)`<Num _>: <{Id ","}* _>, <Id from>, <Id to>, <{Id ","}* _>.` := b};

bool kannUmsteigen(rel[Id,Id] sys, Id hs) = size(sys[hs]) > 1;

void synthesizeDotGraph(loc source, loc target)
{
rel[Id from,Id to] conn = extractGraph(source);
writeFile(target,
"digraph Metro { node [shape=box]
'<for (<from, to> <- conn) {>
' \"<from>\" -\> \"<to>\"<}>
'<for (st <- conn<from>, kannUmsteigen(conn, st)){>
' \"<st>\" [shape=ellipse]<}>
'}");
}
public void main()
{
//parse(#start[System],|home:///projects/slps/topics/implementation/busses/Koblenz.bus|);
synthesizeDotGraph( |home:///projects/slps/topics/implementation/busses/Koblenz.bus|,
|home:///projects/slps/topics/implementation/busses/Koblenz.dot|);
}

0 comments on commit 432c4d0

Please sign in to comment.