What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Has anyone started working on this yet?

share|improve this question
1  
For the people who don't really care to Google an acronym that could mean 100 different things, could you please define BNF –  Tyler Carter Jan 15 '10 at 3:56
    
Oh, and I wasn't the downvote. I don't really down or upvote anything I don't know about. –  Tyler Carter Jan 15 '10 at 4:00
11  
I'm 99% sure me means Backus-Naur Form: en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form / This is not meant as an attempt to be "Elite", but: There is really only one meaning of BNF that applies here, and the people this question is directed at would know what he wants, so there is no implicit need to explain it. Of course, it's always nice though :) –  Michael Stum Jan 15 '10 at 4:01
    
But if we don't know what BNF means, how can we know if it's directed at us? –  Mark Henderson Jan 15 '10 at 4:19
    
The questions's on Meta, so it's directed at us, and as Michael Stum said, there's only one conceivable meaning in this context. I see antony.trupe has volunteered to start it off. Everyone loves a volunteer. –  pavium Jan 15 '10 at 4:49

2 Answers 2

<message> ::= 
<bold> ::=
<italic> ::=
<hyperlink> ::=
<blockquote> ::=
<pre-code> ::=
<img> ::=
<list> ::=
<ol> ::=
<ul> ::=
<h1> ::=
<h2> ::=
<hr> ::=
share|improve this answer
    
starting point. –  antony.trupe Jan 15 '10 at 4:34
3  
If you intend for this to be editable, you'd probably better wiki it. –  mmyers Jan 15 '10 at 5:46
2  
Some code to look at for inspiration: github.com/jgm/peg-markdown/blob/master/markdown_parser.leg –  Stephan202 Jan 15 '10 at 6:05
    
good call mmyers. cw - done. –  antony.trupe Jan 15 '10 at 15:48

I had a little think about this after the podcast last week (having not paid much attention to Markdown before) and it's quite problematic to process with the a standard compiler front-end tool like lex&yacc / ANTLR. The problem is that so much of the language is positional and those tools are really designed to deal with context-free grammars.

It's probably still the way to go, but you need to put a stage infront of the lexer stage to handle it. You'd need to read all the lines into an array first and recognise those that start with quote '>' marks or tab/4space indents, then recognise groups of lines at the same level and insert tokens at the beginning/end of those groups of lines. Then you can proceed in a more context-free manner.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .