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)

1
vote
1answer
56 views

FIRST and FOLLOW sets calculator in Haskell

I found myself wanting to brush up on some notions about parsers and grammars and, at the same time, to exercise my Haskell - I am a Haskell newbie; moreover, I haven't touched the language at all in ...
4
votes
1answer
77 views

Syntax highlighter for HTML and PHP

I've created a JavaScript application to highlight the syntax of HTML and PHP. I know a lot of syntax highlighter are available nowadays, I just created to extend my knowledge in JS and regular ...
4
votes
3answers
133 views

AST implementation

I'm new to C++, so I'm trying to learn the language by implementing all the type systems and languages in Pierce's Types and Programming Languages. My first attempt starts at the very beginning and ...
10
votes
1answer
142 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 ...
11
votes
1answer
138 views

Reference Implementation for Honey Badger programming language

I've been working on my own dynamically-typed, dynamically-scoped, imperative programming language called Honey Badger and feel that it's reached a stable enough state that I want someone else's eyes ...
4
votes
1answer
146 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
130 views

Perl 6: Grammar issues (simple defines)

My goal is to parse defines in Objective-C code: ...
4
votes
1answer
987 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
143 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 ...