Questions tagged [grammar]

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.

5 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
352 views

Eliminating chain rules from context-free grammars

I'm writing a small C program for elimination of chain rules from a context-free grammar. My idea is to rewrite the rules of the grammar in a specific useful order: making groups of productions that ...
4
votes
0answers
47 views

Parsing λ-terms using a very simple grammar

This is my first Rust program. It parses a string into a λ-term using a very simple grammar. Please evaluate style and use of ownerships / borrowing. ...
4
votes
0answers
56 views

Correct user typos in a C source file using Perl 6 grammar

To learn about Perl 6 grammars, I created a simple parser for C source files. Note that this is a constructed example motivated by this question. The point is to parse a C source file and correct user ...
2
votes
0answers
33 views

dyon vim syntax plugin

I recently made vim-dyon which is a syntax highlighter and indenter for the dyon programming language. There are probably some issues with being absolutely correct (since I am not too familiar with ...
0
votes
0answers
29 views

BNF for a number

I'm looking to learn and practice parsing, and so I have started with writing an EBNF for a number (using the python interpreter as an example of possible inputs). Here is what I have so far (also ...