« first day (1138 days earlier)      last day (397 days later) » 

5:56 AM
i am trying to understand this grammar: E:E;e|e e:nve|te| t:n|v v:tA|V n:t[E]|(E)|{E}|N
i think N is the noun, n is an expression in parens, or a projection or enclosed in a lambda
E is the expression
v is the verb
what is the t?
and i dont understand this E:E;e|e line
i think i understand e:nve|te|, it parses stuff like 1+1 and +(1 2 3;4 5 6)
@PyGamer0 it is just a noun or a verb according to the grammar
 
6:18 AM
and A, V are adverbs and verbs
 
 
2 hours later…
8:21 AM
t is for "term" (semi-standard parsing terminology when using rules to determine precedence - usually there are more of those, including e.g. "factor" for multiplication).
v=verb (one), e=expression (one) V=verbs (jone or many, uxtaposed), N = nouns (one or many, juxtaposed), A = adverbs (one or many), E = expression list, semicolon separated, so "E:E;e|e" means: "A list of expressions is either: (a) a list of expressions, followed by semicolon, followed by one expression - or (b) just one expression"
It's recursive in a way that doesn't "seem right" if you're not used to it, but it IS well defined, and many parser generators know how to deal with it. In practice, if you're writing the parser by hand, you'd implement it as "parse the e first; then while (there's a semicolon next) do (parse another e).
 
ah so the semicolon is a literal semicolon
 
Yes. N,A,V are "terminals" that are lexically recognized, and therefore do not need to be specified in the grammar, but E isn't and thus is defined.
Also the ([{}]) characters ore literal, but colon and pipe/or aren't.
 
8:38 AM
expressions : expressions; expression
            | expression

expression : noun verb expression
           | term expression

term : noun
     | verb

verb : term adverbs | verbs

noun : term[expressions]
     | (expressions)
     | {expressions}
     | nouns
 
8:50 AM
yes, that is my understanding.
 

« first day (1138 days earlier)      last day (397 days later) »