Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am implementing a grammar in CUP, and it would often be helpful to see everything at a glance. This could also be useful in finding errors quickly.

Are there any programs out there that will visualize grammar in the CUP syntax? Or can you think of a very easy way of doing it (for instance, convert the grammar to another format that program X can read).

share|improve this question
3  
Some warning on the bright yellow would be nice... My eyes hurt... –  Yannis Rizos Jan 23 '12 at 3:23
1  
@YannisRizos Just be happy there aren't flashing rainbow GIFs. –  Glenn Nelson Jan 23 '12 at 3:25
1  
ANTLR has excellent visualisation, at least of parse trees. (I don't recall if you can visualise the grammar itself). I've never heard of CUP, so I don't know if there's some reason to prefer it, or indeed if the two are interchangeable. –  Steve Bennett Jan 24 '12 at 21:33
    
last updated 2009? –  Paul Jun 19 '12 at 19:40
add comment

1 Answer

You might need to convert it to another format first.

You could generate a graph of the grammar by using a combination of ANTLRWorks and GraphViz.

Someone did something similar here to generate graphs for the Ruby, JavaScript, and Java 1.5 grammars.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.