I want to express a grammar rule that is written in BNF using Lisp. here is the rule. It is important to note that non-terminals are represented in capital letters and the terminals are represented in small letters:
A -> a A b
I tried to use the define function of lisp to define that grammar. However when I use a define function Lisp obliges me to specify the body of the function that I defined.
#lang racket (define (A a A b B)())
However if I fill the body with whatever like:
#lang racket (define (A a A b B)("Hello World"))
I don't get any error.
My question here is whether I should specify something in the body that will help me define other rules of the grammar, for example should I specify in the body of
A the rule for the non terminal
B? If that
define () function is not the right one to use, what other function(s) would help me represent that BNF grammar using Lisp?