Question

Both are technologies that are expressed via languages full of macros, but in a more technical terms, what is the kind of grammar and how to describe their own properties ?

I'm not interested in a graphical representation, by properties I mean a descriptive phrase about this subject, so please don't just go for a BNF/EBNF oriented response full of arcs and graphs .

I assume that both are context-free grammars, but this is a big family of grammars, there is a way to describe this 2 in a more precise way ?

Thanks.

No correct solution

OTHER TIPS

TeX can change the meaning of characters at run time, so it's not context free.

Is my language Context-Free?

I believe that every useful language ends up being Turing-complete, reflexive, etc.

Fortunately that is not the end of the story.

Most of the parser generation tools (yacc, antler, etc) process up to context-free grammars (CFG).

So we divide the language processing problem in 3 steps:

  1. Build an over-generating CFG; this is the "syntactical" part that constitutes a solid base where we add the other components,
  2. Add "semantic" constraints (with some extra syntactic and semantic constraints)
  3. main semantics ( static semantics, pragmatics, attributive semantics, etc)

Writing a context-free grammar is a very standard way of speaking about all the languages! It is a very clear and didactic notation for languages!! (and sometimes is not telling all the truth).

When We say that "is not context-free, is Turing-complete, ..." you can translate it to "you can count with lots of semantic extra work" :)

How can I speak about it?

Many choices available. I like to do a subset of the following:

  1. Write a clear semantic oriented CFG
  2. for each symbol (T or NT) add/define a set of semantic attributes
  3. for each production rule: add syntactic/semantic constraints predicates
  4. for each production rule: add a set equations to define the values of the attributes
  5. for each production rule: add a English explanation, examples, etc
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top