Tool for generating railroad diagram used on json.org [closed] - bnf

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I love the syntax of railroad diagrams on json.org which are a graphical representation of the BNF language. I haven't found any tools that can produce results as eloquently.
Can anyone identify the tool used to generate these diagrams?

There is an Online Railroad Diagram Generator. It creates SVG syntax diagrams, also known as railroad diagrams, from context-free grammars specified in EBNF. You can copy the SVG code or take screen shots.
You have to type in the grammar and it'll make the diagram.
For example, to create the first railroad diagram you show, you would use the code:
object ::= '{' ((string ':' value ) ( ',' string ':' value )*)? '}'
Then you could go on to define string and value using string ::= ... and value ::= ... The references are all shown.
Check out some of the example diagrams on the page. They have XML and even EBNF itself.

from Douglas Crockford
to Aleem B
date Tue, Apr 28, 2009 at 6:01 PM
subject Re: Railroad Diagrams on json.org
I drew them with Visio. Creative
Docs.NET also works well.
--
Aleem B wrote:
Hello Douglas,
I thoroughly enjoy most things you put
out there and the railroad diagrams on
json.org are no different. I have been
trying to look around for a tool that
would generate diagrams nearly as
eloquent but have had no luck:
Tool for generating railroad diagram used on json.org
Is there some tool you used to convert
the BNF to these diagrams or were they
hand crafted?
-- Aleem

Tab Atkins Jr. created a Javascript Railroad-diagram Generator using svg specifically because he could not find one that had the visual appeal he wanted , i.e. "the JSON.org look".

There was a similar question a few days ago:
What is a good tool for creating railroad diagrams?
That question was about how railroad diagrams in the SQLite syntax diagrams were generated. The accepted answer found that the diagrams were generated using a DSL written in Tcl.
Another answer offered a suggestion to use a diagram generator which works off of EBNL grammar.

I have been looking also for the tools used to generate these Syntax Diagrams and if possible in js library so it can be edited and displayed without awaiting a boring time for a graphic to come.
I know there are tools out there but I would say that the generator from bottlecaps.de has a nice graphic with color option. Unfortunately I could not get source code of the tool it self there.
I went also to the related questions of answers here but got only followings where we can get it as open source js library and provided with an online demo where we can try and play with.
railroad diagram generator from tabatkins, in js (Syntax exists as a Python library as well)
js-sequence-diagrams from bramp, in js but UML (Syntax is generated via bottlecaps.de)
umlClass from GoJS, in js but found only for UML

One of the things that IBM's railroad track generator handles well is default values. I have not seen another generator that does this.
An example is
┌─────◀────┐┌(──«defaults»─)─┐
▶▶─COMMAND┴«argument»┴┼────────────────┼──────────────────────▶◀
│ ┌────◀─────┐ │
└(┴┬«option»┬┴┬─┬┘
└Help────┘ └)┘

I found J-algo tool. I think it is very easy to draw diagram but I can't export to image or another type.
http://j-algo.binaervarianz.de/index.php

Take a look at http://code.google.com/p/html-railroad-diagram/ which generates HTML railroad diagrams. There is an example that shows the JSON railroad generated in an HTML page by JavaScript with links.

I seem to remember that IBM has a tool that builds such diagrams as part of their BookMaster SGML suite. Railroad diagrams are often used in mainframe documentation.

Related

Documentation tool for Ada software

Brief: I'm looking for some kind of tool to produce a software description from the comments in existing software source code.
In more detail: I've got existing source code written in Ada. Changes need to be made to this source code and I also need to generate a document containing a description of the software as a whole and all of its packages, routines etc. (if possible as PDF). For the existing routines these source code comments already exist and contain sufficient detail for my needs.
The description shall include at least
overall software design
textual description of packages, routines, variables, constants etc.
call and caller graphs
For projects based on C I'd do this using Doxygen. Doxygen itself, however, does not cope with sotware written in Ada. My thought was to (automatically) convert existing comments in the source code so that Doxygen can read these. The conversion itself was no problem (using Doxygen's filter mechanism), but as keywords and syntax between C and Ada differ a lot, this did not produce any useable output.
I then had a look at Understand from SciTools. While this analyses the software to a good detail and generates nice metrices, I was not able to get anything out of it, that resembles a document with what I need.
I want to avoid (manually) writing a separate document, but instead would like to generate this from the code base. I will have to put all the necessary information (perhaps with the the exception of a general overview) there anyhow, so why not use it for documentation purpose as well.
Is there any tool that is able to do what I need?
There's a tool called "AdaDoc", which seems to do a part of what you're asking for. You can of course use "a2ps" for the textual part of your needs (I like that better than what AdaDoc generates).
There are several UML tools ("Umbrello" is one name I remember), which offer to create graphs of inter-package relations, but for a seriously sized project, the best option is to use the original design documents, and simply verify that the source text actually matches that design.
For languages not supported by Doxygen, I've written my own "general purpose" filter.
It's very basic, but useful for me.
https://github.com/malkev/doxphp

Analyze partial or corrupted QR codes [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
How can I analyze broken/partial QR codes? Normally a QR decoder will just tell you that the data can not be read. This is not very useful. Even though the code is not readable, some information can, presumably, be extracted!
Is the finder patterns found?
Is the timing pattern found?
What is the version?
What is the error level?
What is the mask?
Is the format intact?
What is the mode?
Is the stop pattern found after the correct length?
Is there any meaningful data?
How can I extract this information from broken/partial QR codes?
This is a question that comes up in many ways; some easier than others.
To answer your direct question: The tool you need: Your brain.
Software can help but to decode partial or misprinted codes takes some work. It is like detective work. You need to take what you have and fill in what you know about the way they are created in the first place, then make educated guesses for the win.
Here is a tour of the concept. By looking at these articles most of the items on your bullet-point list will be answered.
This article explains the overall format in good detail:
Wounded QR Codes
For instance, here is the first image in the article about formatting:
Here is a real-world example of the process of decoding a partial image:
Decoding a partial QR code
It begins with the challenge image
Then shows you the order of bits that are encoded:
Then through the process of detective work to produce the final image:
Here is a different problem. You have a full image but it won't scan properly so you have to decode it by hand:
Decoding small QR codes by hand
It starts out with a tattoo:
Which is in the wrong orientation, and also won't scan properly.
So you work through the decoding process:
Yielding the final result: Maci Clare Peltz
Have fun detecting!
You can simply hack some open source code like zxing to print out its progress on a command line during decoding and in that way see how far it got. Just sprinke in a few System.out.println() statements.
The problem is false positives. It will almost always find at least 3 regions that look like a QR code's finder patterns; it always takes the 3 most likely candidates. They usually are phantoms since you're usually not looking at a QR code. The next step would then fail, finding valid version info. (In a very unlikely case it would even find phantom version info.)
Some of these aspects you mention aren't necessarily detected by a library since they don't have to be, like timing pattern and stop pattern (which isn't required for short data).
Aside from those caveats, should be easy.

Common Lisp package for parsing invalid HTML? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
As a learning exercise, I'm writing a web scraper in Common Lisp. The (rough) plan is:
Use Quicklisp to manage dependencies
Use Drakma to load the pages
Parse the pages with xmls
I've just run into a sticking point: the website I'm scraping doesn't always produce valid XHTML. This means that step 3 (parse the pages with xmls) doesn't work. And I'm as loath to use regular expressions as this guy :-)
So, can anyone recommend a Common Lisp package for parsing invalid XHTML? I'm imagining something similar to the HTML Agility Pack for .NET ...
The "closure-html" project (available in Quicklisp) will recover from bogus HTML and produce something with which you can work. I use closure-html together with CXML to process arbitrary web pages, and it works nicely. http://common-lisp.net/project/closure/closure-html/
For next visitors: today we have Plump: https://shinmera.github.io/plump
Plump is a parser for HTML/XML like documents, focusing on being lenient towards invalid markup. It can handle things like invalid attributes, bad closing tag order, unencoded entities, inexistent tag types, self-closing tags and so on. It parses documents to a class representation and offers a small set of DOM functions to manipulate it. You are free to change it to parse to your own classes though.
and them we have other libs to query the document, like lquery (jquery-like) or CLSS (simple CSS selectors) by the same author.
We also now have a little tutorial on the Common Lisp Cookbook: https://lispcookbook.github.io/cl-cookbook/web-scraping.html
See also Common Lisp wiki: http://www.cliki.net/Web
Duncan, so far I've been successful using Clozure Common Lisp under both Ubuntu Linux and Windows (7 & XP), so if you're looking for an implementation that will work anywhere you might try this one.

How can I visualize Fortran (90 or later) source code, e.g. using Graphviz? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I've been thrown into a large Fortran project with a large number of source files.
I need to contribute to this project and it would seem prudent that I first understand the source.
As a first step, I'd like to visualize the interdependences between the various source files, i.e. which source files need which modules. As far as I can tell, automated methods exist for other languages and result in a graph that can be built using Graphviz.
But is anyone aware of software out there that can do this for Fortran 90 code?
[Searching the interwebs for Fortran help is a real pain as you end up searching the inter-cobwebs thanks to the painfully ubiquitous FORTRAN 77.]
I would recommend doxygen, which automatically generates documentation from source code (and is free). Usually you add some markup to comments describing your functions and variables. However, you can just run doxygen on undocumented source files, provided you set EXTRACT_ALL to YES in the configuration file, and have it create create relationship diagrams for all your functions (i.e. this function call these functions and is called by these other functions).
You need GraphViz installed to get diagrams generated and have the HAVE_DOT option set to YES in the configuration file.
See the doxygen documentation for graphs and diagrams for more information and this example class documentation for a example of the output generated.
Edit: Of course for Fortran you should set the OPTIMIZE_FOR_FORTRAN option to YES in the configuration file.
If you have money then Understand for Fortran is worth looking at. If you don't have money but intend to work quickly then you might get by with a trial download of the software.
For a static call graph, I've never found a free tool as useful as Understand; it's hard to find any free tools let alone a useful one. I'd write one myself but the market would be tiny :-(
For a dynamic call graph investigate your compiler options. I use the Intel Fortran Compiler which can generate a mound of useful information about an executing program. The TotalView debugger can also visualise the call graph of an executing program. You should also look at gprof2dot which makes a DOT file out of a GPROF call 'graph'. This is free and OK.
And I should also add, though it's not something I've ever used, that Callgrind may be of use.
You can use callgrind from within Valgrind:
valgrind --tool=callgrind [your program]
This will produce a callgrind.out.[pid] file. This works best if you compile your program without optimisations, and with debug flags.
You then have a couple of options for viewing the data:
Convert the callgrind output to a .dot file with grof2dot, and then view it with xdot, or convert it to a static graph with GraphViz.
View it directly with Kcachegrind (includes source analysis, and call graphs).

How can I learn to create beautiful infographics (with connection to my R knowledge)? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am a devoted R (r-project.org) user, and love infographics.
I just came across this article:
http://www.noupe.com/design/fantastic-information-architecture-resources.html
Giving a long list of resources for information designers.
And it raised in me the desire to do more beautiful (not just informative) R plots.
Do you have any suggestion/resources on how to make this leap?
What books/software/skills do I need to have/develop in order to be able to make beautiful infographics?
Here's a list of resources that I would suggest:
Tufte's books are really excellent, although my favorite is actually his second book: Envisioning Information. Separately, I always found the periodic table of visualization methods to be entertaining. Ross Ihaka also taught a course on this subject in the past.
For R, learn ggplot2. The learnr.wordpress.com blog is an excellent resource for this. You might consider the ggplot book and the original Grammar of Graphics book.
Here's another useful article from the same site that you linked in your question: Data Visualization: Modern Approaches.
Some good blogs on the subject:
http://www.informationisbeautiful.net/
http://flowingdata.com/
In some cases, you might want to do your data manipulation in R, but create the visualization with another tool (see, for instance, this list). Here are some of the best tools that I have found over the years:
Processing
Prefuse
Protovis
Lastly, an interesting open visualization platform was many eyes.
You might want to look into using R to create your underlying graphics, and then saving them in an editable format (like svg). Then using a more art focused application to edit your svg to make it beautifull (like Inkscape). See my previous question for an example using Cairo. I'd also +1 the learn ggplot2 from Shane.
If the R side of your skills is pretty good, then you'll definitely want to start reading Edward Tufte's books, particularly The Visual Display of Quantitative Information and Beautiful Evidence, both of which provide excellent insights into how to present data effectively and efficiently.
You should be somewhat forewarned that everyone has a different idea of "beautiful," however. Tufte is a big believer in maximizing a quantity he calls the "data-ink ratio": how much of the page's ink is dedicated to data instead of what he calls "chartjunk". This causes his work to have a sleek, minimalist oeuvre that certainly makes it easier to digest everything but that some people may find too utilitarian. But for Tufte, function and form are pretty close to one thing: the more it helps you, the more beautiful and elegant it is.
The tikz manual contains a few dozen pages on how to make good graphics (using tikz). So it's not entirely specific to R, but the ideas are interesting and worked out with examples.
I don't know what's the ultimate goal of your visualizations, but if LaTeX is involved (and when is it not involved for beautiful typography? ;)) it can be a good idea to rework your graphics in a vector graphics language, as Shane suggested.
I am using Tableau Public, it is free software to create charts and maps. Charts are not stunning but I like maps, I do not know better free software for info maps creation.
a good option is to make your own flash components for visual studio and work with they in asp.net

Resources