1
1
# -*- Mode: POLY-ORG ;-*- ---
2
- #+Title: a S-expression presentation of GraphViz DOT language
2
+ #+Title: an S-expression presentation of GraphViz DOT language
3
3
#+OPTIONS: tex:t toc:2 \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
4
4
#+STARTUP: latexpreview
5
5
#+STARTUP: noindent
11
11
- [[#preparation][Preparation]]
12
12
- [[#language-presentation][Language presentation]]
13
13
- [[#global-variables][global variables]]
14
- - [[#the-encode -stream][the encode stream]]
14
+ - [[#the-encoded -stream][the encoded stream]]
15
15
- [[#the-indent-level][the indent level]]
16
16
- [[#the-default-size-for-indent-tab][the default size for indent tab]]
17
- - [[#how-to-render-a -s-graphviz-s-expression][how to render a S-GRAPHVIZ S-expression]]
17
+ - [[#how-to-render-an -s-graphviz-s-expression][how to render an S-GRAPHVIZ S-expression]]
18
18
- [[#graph][graph]]
19
19
- [[#stmt-list][stmt-list]]
20
20
- [[#stmt][stmt]]
@@ -68,24 +68,24 @@ subgraph : [ subgraph [ ID ] ] '{' stmt_list '}'
68
68
compass_pt : (n | ne | e | se | s | sw | w | nw | c | _)
69
69
#+end_src
70
70
** global variables
71
- *** the encode stream
71
+ *** the encoded stream
72
72
The encoded DOT expressions will print to this stream.
73
73
#+BEGIN_SRC lisp
74
74
(defvar *dot-stream*)
75
75
#+END_SRC
76
76
*** the indent level
77
- How many whitespaces will be written before printing current DOT expression.
77
+ How many white spaces will be written before printing current DOT expression.
78
78
#+BEGIN_SRC lisp
79
79
(defvar *indent-spaces* 0)
80
80
#+END_SRC
81
81
*** the default size for indent tab
82
82
#+BEGIN_SRC lisp
83
83
(defvar *indent-tab-size* 2)
84
84
#+END_SRC
85
- ** how to render a S-GRAPHVIZ S-expression
85
+ ** how to render an S-GRAPHVIZ S-expression
86
86
Renders a s-graphviz graph into a graphic file.
87
- ~file-name~ should be a pathname .
88
- If the file-name is ~/foo/bar.png~ , the DOT file ~/foo/bar.dot~ is created
87
+ ~file-name~ should be a path name .
88
+ If the file-name is ~/foo/bar.png~, the DOT file ~/foo/bar.dot~ is created
89
89
and then rendered.
90
90
Format should be one out of http://www.graphviz.org/doc/info/output.html,
91
91
for example svg, ps, gif, png, or jpg.
@@ -107,7 +107,7 @@ for example svg, ps, gif, png, or jpg.
107
107
:ignore-error-status t)))
108
108
#+END_SRC
109
109
110
- We will provide a helpful routine to render a S-GRAPHVIZ S-expression and open it in Emacs.
110
+ We will provide a helpful routine to render an S-GRAPHVIZ S-expression and open it in Emacs.
111
111
#+BEGIN_SRC lisp :load dev
112
112
(defmacro render-and-open-s-graphviz (file-name &rest left-args)
113
113
(let ((real-file-name (gensym "file-name")))
@@ -156,7 +156,7 @@ We will provide a helpful routine to render a S-GRAPHVIZ S-expression and open i
156
156
157
157
** stmt-list
158
158
a graph is established by a stmt_list.
159
- We can also apply some global configuration in a ~stmt_list~ to limit their affection scope,for example:
159
+ We can also apply some global configuration in a ~stmt_list~ to limit their affection scope, for example:
160
160
#+BEGIN_SRC lisp :load no
161
161
(render-and-open-s-graphviz
162
162
(merge-pathnames
@@ -193,7 +193,7 @@ We can also apply some global configuration in a ~stmt_list~ to limit their affe
193
193
#+END_SRC
194
194
195
195
** stmt
196
- There are many different kinds of statements,let's recognize them one by one.
196
+ There are many kinds of statements, let's recognize them one by one.
197
197
198
198
#+BEGIN_SRC lisp
199
199
(defun format-stmt (stmt)
@@ -208,7 +208,7 @@ There are many different kinds of statements,let's recognize them one by one.
208
208
209
209
** node statement
210
210
211
- If a statement starts without a known keyword, then it's a node statement,for example
211
+ If a statement starts without a known keyword, then it's a node statement, for example
212
212
#+BEGIN_SRC lisp :load no
213
213
(render-and-open-s-graphviz
214
214
(merge-pathnames
@@ -230,7 +230,7 @@ If a statement starts without a known keyword, then it's a node statement,for ex
230
230
#+begin_src bnf
231
231
node_id : ID [ port ]
232
232
#+end_src
233
- In a S-expression, it can be a single id or a list contains both id and port.
233
+ In an S-expression, it can be a single id or a list contains both id and port.
234
234
#+BEGIN_SRC lisp
235
235
(defun format-node-id (id-port)
236
236
(if (atom id-port)
@@ -246,7 +246,7 @@ In a S-expression, it can be a single id or a list contains both id and port.
246
246
edge_stmt : (node_id | subgraph) edgeRHS [ attr_list ]
247
247
edgeRHS : edgeop (node_id | subgraph) [ edgeRHS ]
248
248
#+end_src
249
- In a S-expression, it's a list that starts with an ~edgeop~ and an ~attr_list~ and
249
+ In an S-expression, it's a list that starts with an ~edgeop~ and an ~attr_list~ and
250
250
the rest are a list of ~node id~, for example
251
251
#+BEGIN_SRC lisp :load no
252
252
(render-and-open-s-graphviz
@@ -282,7 +282,7 @@ the rest are a list of ~node id~, for example
282
282
#+begin_src bnf
283
283
attr_stmt : (graph | node | edge) attr_list
284
284
#+end_src
285
- In a S-GRAPHVIZ S-expression, it starts with keyword ~:graph~, ~:node~, ~:edge~ , and the rest items
285
+ In an S-GRAPHVIZ S-expression, it starts with keyword ~:graph~, ~:node~, ~:edge~ , and the rest items
286
286
in the list is the ~attr_list~(ref:attr-list),for example:
287
287
#+begin_src lisp :load no
288
288
(render-and-open-s-graphviz
@@ -307,7 +307,7 @@ in the list is the ~attr_list~(ref:attr-list),for example:
307
307
#+END_SRC
308
308
** attribute
309
309
a single attribute can be applied to global environment in a statement,
310
- in a S-GRAPHVIZ S-expression, it looks like this:
310
+ in an S-GRAPHVIZ S-expression, it looks like this:
311
311
#+BEGIN_SRC lisp :load no
312
312
(render-and-open-s-graphviz
313
313
(merge-pathnames
@@ -329,7 +329,7 @@ in a S-GRAPHVIZ S-expression, it looks like this:
329
329
#+END_SRC
330
330
** subgraph
331
331
It a subgraph's name starts with "cluster", then it has a special meaning.
332
- in a S-GRAPHVIZ S-expression, it looks like this:
332
+ in an S-GRAPHVIZ S-expression, it looks like this:
333
333
#+BEGIN_SRC lisp :load no
334
334
(render-and-open-s-graphviz
335
335
(merge-pathnames
@@ -375,7 +375,7 @@ port : ':' ID [ ':' compass_pt ]
375
375
| ':' compass_pt
376
376
compass_pt : (n | ne | e | se | s | sw | w | nw | c | _)
377
377
#+end_src
378
- In a S-GRAPHVIZ S-expression, it looks like this:
378
+ In an S-GRAPHVIZ S-expression, it looks like this:
379
379
#+BEGIN_SRC lisp :load no
380
380
(render-and-open-s-graphviz
381
381
(merge-pathnames
@@ -405,7 +405,7 @@ label:attr-list
405
405
attr_list : '[' [ a_list ] ']' [ attr_list ]
406
406
a_list : ID '=' ID [ (';' | ',') ] [ a_list ]
407
407
#+end_src
408
- In a S-expression, it is an association list like this:
408
+ In an S-expression, it is an association list like this:
409
409
#+BEGIN_SRC lisp :load no
410
410
((:label "a label") (:shape :box))
411
411
#+END_SRC
0 commit comments