I am developing a new programming language for a project work. The new language compilers to html, I am currently working on the compiler. I know compilers have three (3) stages. #1 the lexical stage where tokens are generated form the grammar of the language, the next stage is the parser and then the output. My question is how do i start writing the grammar. Do i do it in an essay form or just short statement. Point me to resources that can help me. I have read a lot and all don't teach you how to write the grammar so if you can give an example. I am writing the compiler in python and using the lax/yacc modules called PLY
an example is:
HTML5 main{
myHead.id = "cat";
myTitle;
}
HEAD myHead;
TITLE myTitle = "text";
output of the above code in html is:
<DOCTYPE>
<HTML>
<head id="cat">
<TITLE>text</TITLE>
</head>
<body>
</body>
</HTML>