A formal grammar is a set of production rules that describe how to form strings of valid syntax. Formal grammars are most often used to specify the syntax of a programming language.

learn more… | top users | synonyms (1)

7
votes
1answer
47 views

Unit test code for Antlr Grammar

I'm working on a grammar for the Visual Basic for Applications (VBA) programming language. I've discovered a way to make assertions about how a parse tree should be generated by using the Antlr ...
4
votes
1answer
78 views

Expressing Rebol Dates in EBNF

I'm looking to define the Rebol date format in EBNF notation. I'd like as best as possible to only define valid dates—at least those that are valid in Rebol at the moment: ...
3
votes
2answers
92 views

Perl 6: Grammar issues (simple defines)

My goal is to parse defines in Objective-C code: ...
4
votes
1answer
783 views

PEG.js grammar for parsing CSS selectors

I have a library that's parsing some expressions, part of which is a CSS selector. More accurately, it's a jQuery-compatible selector. The selector itself is opaque to my library - I don't need to ...
2
votes
1answer
138 views

Expanding a synchronous grammar

Background: A synchronous grammar is a like two context-free grammars connected in parallel. It is used for translation. For example, here is a small synchronous grammar that can be used for ...