emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: Request for worg page -- escaping questions
@ 2014-04-18  3:21 Rustom Mody
  2014-04-18  7:08 ` Alan Schmitt
  2014-04-18 12:00 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Rustom Mody @ 2014-04-18  3:21 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Thu, Apr 17, 2014 at 9:42 PM, Bastien <bzg@gnu.org> wrote:

> Hi Rustom,
>
> Rustom Mody <rustompmody@gmail.com> writes:>
> > Just expressing a similar need of org-moders!
>
> Hopefully you get enough to start a tutorial on Worg :)
>
>
Heh!
Ok thats the least I can do.
Trouble is you guys are the hares that make us (me at least) into tortoises
--
you add significant functionality faster than I can keep with the 'what'
(leave aside how and details).

Still I'll try my hand.
What I would like is a graphic -- an automata-diagram made perhaps by dot.
Can that easily/conveniently go up onto worg?

-- 
http://www.the-magus.in
http://blog.languager.org

[-- Attachment #2: Type: text/html, Size: 1535 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for worg page -- escaping questions
  2014-04-18  3:21 Request for worg page -- escaping questions Rustom Mody
@ 2014-04-18  7:08 ` Alan Schmitt
  2014-04-18 12:00 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2014-04-18  7:08 UTC (permalink / raw)
  To: Rustom Mody; +Cc: Bastien, emacs-orgmode

Hi Rustom,

On 2014-04-18 05:21, Rustom Mody <rustompmody@gmail.com> writes:

> What I would like is a graphic -- an automata-diagram made perhaps by
> dot. Can that easily/conveniently go up onto worg?

I don't know how worg's export is configured, but something like this
may work ...

--8<---------------cut here---------------start------------->8---
# -*- org-confirm-babel-evaluate: nil -*-

#+name: mygraph
#+begin_src dot :file mygraph.png :exports results
digraph {
  9 -> 4 [label=c];
  9 -> 2 [label=" n"];
  9 -> 9 [label=" e"];
  5 -> 3 [label=" e"];
  2 -> 4 [label=" k"];
  4 -> 9 [label=" j"];
}
#+end_src

#+results: mygraph
--8<---------------cut here---------------end--------------->8---

You can, if you need, build the contents of the dot block from another
babel block.

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for worg page -- escaping questions
  2014-04-18  3:21 Request for worg page -- escaping questions Rustom Mody
  2014-04-18  7:08 ` Alan Schmitt
@ 2014-04-18 12:00 ` Bastien
  2014-04-20  7:59   ` Rustom Mody
  1 sibling, 1 reply; 7+ messages in thread
From: Bastien @ 2014-04-18 12:00 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

Rustom Mody <rustompmody@gmail.com> writes:

> Trouble is you guys are the hares that make us (me at least) into
> tortoises --
> you add significant functionality faster than I can keep with the
> 'what' (leave aside how and details).

Well, remember that Worg is here to *stay* -- so let's start with
basic stuff, not bleeding-edge features.  There is a lot of basic
stuff we still need to document... and we also need to clean-up
stuff... but agreed that's pretty boring :/

> Still I'll try my hand.
> What I would like is a graphic -- an automata-diagram made perhaps by
> dot.
> Can that easily/conveniently go up onto worg?

Of course!  Thanks in advance,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for worg page -- escaping questions
  2014-04-18 12:00 ` Bastien
@ 2014-04-20  7:59   ` Rustom Mody
  2014-04-20  8:43     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Rustom Mody @ 2014-04-20  7:59 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 992 bytes --]

On Fri, Apr 18, 2014 at 5:30 PM, Bastien <bzg@gnu.org> wrote:

> Rustom Mody <rustompmody@gmail.com> writes:
>
> > Trouble is you guys are the hares that make us (me at least) into
> > tortoises --
> > you add significant functionality faster than I can keep with the
> > 'what' (leave aside how and details).
>
> Well, remember that Worg is here to *stay* -- so let's start with
> basic stuff, not bleeding-edge features.  There is a lot of basic
> stuff we still need to document... and we also need to clean-up
> stuff... but agreed that's pretty boring :/
>
> > Still I'll try my hand.
> > What I would like is a graphic -- an automata-diagram made perhaps by
> > dot.
> > Can that easily/conveniently go up onto worg?
>
> Of course!  Thanks in advance,
>
>
Thanks to Alan's dot, Ive come up with something (attached).
Leave aside complete, its not even really work-in-progress :-)
Just a sense of the direction I was asking for.

Would such a doc be appropriate for worg?

Regards,
Rusi

[-- Attachment #1.2: Type: text/html, Size: 1722 bytes --]

[-- Attachment #2: orgdfa.org --]
[-- Type: application/octet-stream, Size: 4250 bytes --]

# -*- org-confirm-babel-evaluate: nil -*-
#+TITLE: Org Mode Automaton
#+OPTIONS: toc:nil
* Preliminary Analogy
** Terminology
Below, /programming language/ is used rather generically, ie. 
- C, Elisp, python are programming languages
- So are latex, html 
- And of course org-mode!
** Tokenization
Most people understand that programming languages have /syntax/. But before syntax can come into play, somehow one needs to work out what are the basic elements which are syntactically organized. This is called /tokenization/ (or /lexical analysis/ if one prefers jargon). Typical tokens of a programming language are:
- identifiers (variables)
- numerals (number literals)
- keywords (best to distinguish keywords like =if= from other variables)
And 2 critical ones:
- comments
- strings

For example in most PLs, identifiers must start with letters but thereafter both letters and digits are allowed. This clearly implies that the tokenizer must be in a different /state/ when
- the first character of an identifier is seen
- when the remaining are being seen
- when something other than an identifer is being seen

In fact tokenization of a programming language can involve an automaton having hundreds of states.  For most programmers this is irrelevant -- they need not think or know of this -- what we may call the micro-level of the automaton.

However there is another higher level of the tokenizing automaton that a programmer needs to get  -- I'll call that the  macro-level.

My wish in writing this is that I start with what I understand (reasonably!) well -- the C automaton.  And then work out (with devs and others' help) what the org-mode automaton is (which I expect is far more intricate than the C one).
** C Automaton
#+name: cdfa
#+begin_src dot :file cgraph.png :exports results
digraph {
  Default -> Comment [label = "/*"];
  Comment -> Default [label = "*/"];
  Default -> String  [label = "\""];
  String -> Default  [label = "\""];
}
#+end_src

#+results: cdfa
[[file:cgraph.png]]

In words this says:
- By default the C tokenizer is in the *Default* state
- When a "/*" is seen it goes into the *Comment* state
- When a "*/" is seen in the *Comment* state it returns to the *Default* state (corresponds to the intuition that the comment ends)

  The above line also indicates why its necessary to have such a doc: I do not know how to write the string consisting of star (*) / without the * starting a bold section
- Likewise the " both starts and ends the *String* state

Now there are many implications even from the above (over-simplified) diagram:
1. Comments cannot contain strings -- Ok
2. Strings cannot contain comments -- Ok
3. Comments cannot contain a "*/"
4. Strings cannot contain a double-quote

3 is true of C. \\
Now 4 is actually not true of C. This is accomplished with the aid of the notion of...
** Escaping
C allows a double quote to be *escaped* with a "/" into a string
#+name: cdfa2
#+begin_src dot :file cgraph2.png :exports results
digraph {
  Default -> Comment [label = "/*"];
  Comment -> Default [label = "*/"];
  Default -> String  [label = "\""];
  String -> Default  [label = "\""];
  String -> EscString [label = "\"\\\""];
  EscString -> String [label = "[\"|\\\]"];
}
#+end_src
#+results: cdfa2
[[file:cgraph2.png]]

What this addition is saying is that:
1. In the *String* state a backslash puts the automaton into a special *EscString* state
2. In the *EscString* state either of a double-quote or a backslash puts it back into the *String* state
3. Nothing else is acceptable in the *EscString* state

So much for analogies and preliminaries. The purpose of this writeup is to flesh out the following:
* Org mode Automaton
#+name: orgdfa
#+begin_src dot :file orggraph.png :exports results
digraph {
  Default -> "HeaderLine(Q1)" [label = "\"^#+\""];
  "HeaderLine(Q1)" -> Default [label = "newline"];
  Default -> TableMode  [label = "\"|\""];
  TableMode -> Default  [label = "Note1."];
  Default -> "??"  [label = "\"^:\""];
  Default -> "???"  [label = "\"^'\"Note2"];
}
#+end_src

#+RESULTS: orgdfa
[[file:orggraph.png]]



Notes
1. A line that starts with a non-"|" character \\
2. A single-quote at start of line \\

Questions
1. Should that be HeaderLine or OptionKeywordLine?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for worg page -- escaping questions
  2014-04-20  7:59   ` Rustom Mody
@ 2014-04-20  8:43     ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2014-04-20  8:43 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

Hi Rustom,

Rustom Mody <rustompmody@gmail.com> writes:

> Would such a doc be appropriate for worg?

this looks like a nice blog entry, but that's also fine on Worg: there
is a users directory where people are welcome to put writings of their
own like this one.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for worg page -- escaping questions
  2014-04-02  4:40 Rustom Mody
@ 2014-04-17 16:12 ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2014-04-17 16:12 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

Hi Rustom,

Rustom Mody <rustompmody@gmail.com> writes:

>  1. How to put a '=' into code

~=~

>  2. How to start a line with a '*' -- (a) for headers (b) for
>     ordinary lines?

*A line.

* A header

* * A header starting with a '*'

>  3. How to enter a '|' into tables

IIRC this is a FAQ: http://orgmode.org/worg/org-faq.html

>  4. Newlines -- \\ behaves inconsistently in latex and html [Same  as
>     above because its about escaping newlines]

You mean it is "visually inconsistent" or "functionally" inconsistent?

(In HTML \\ will insert <br/>, which is the right thing to do IMO.)

>  5. How to make normal (ie not radio) text like this <<some-text>>

Remove radio links from `org-activate-links'.

>  6. How to make normal text that looks like  [fn::somestuff]

Mhhh... what do you mean by look like?

> Note all these may not have solutions, eg a C programmer cannot get a
> '*/' into a comment however he may try.  However he can get a '\'
> into a string or a quote mark itself with '\\' and '\"'.  For getting
> a '%' into a printf format however, '\%' is not the way but '%%' Such
> things are documented (and taught to) C programmers.
>
> Just expressing a similar need of org-moders!

Hopefully you get enough to start a tutorial on Worg :)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Request for worg page -- escaping questions
@ 2014-04-02  4:40 Rustom Mody
  2014-04-17 16:12 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Rustom Mody @ 2014-04-02  4:40 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

Over time in using org Ive come up with some issues.
Some have been solved. Some I was shown workarounds.
Some remain unsolved.

Many of these issues can be clubbed together under what computer folk call
'escaping'.

Can we have a worg page for such as the following?

   1. How to put a '=' into code
   2. How to start a line with a '*' -- (a) for headers (b) for ordinary
   lines?
   3. How to enter a '|' into tables
   4. Newlines -- \\ behaves inconsistently in latex and html [Same  as
   above because its about escaping newlines]
   5. How to make normal (ie not radio) text like this <<some-text>>
   6. How to make normal text that looks like  [fn::somestuff]

Note all these may not have solutions, eg a C programmer cannot get a '*/'
into a comment however he may try.  However he can get a '\' into a string
or a quote mark itself with '\\' and '\"'.  For getting a '%' into a printf
format however, '\%' is not the way but '%%' Such things are documented
(and taught to) C programmers.

Just expressing a similar need of org-moders!

Regards,

Rusi

[-- Attachment #2: Type: text/html, Size: 1399 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-20  8:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18  3:21 Request for worg page -- escaping questions Rustom Mody
2014-04-18  7:08 ` Alan Schmitt
2014-04-18 12:00 ` Bastien
2014-04-20  7:59   ` Rustom Mody
2014-04-20  8:43     ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2014-04-02  4:40 Rustom Mody
2014-04-17 16:12 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).