0

Considering the Wavefront obj file format where this syntax fits in the Chomsky hierarchy and why ? I'm also not sure if PEG grammars are being considered in the kind of classification made by Chomsky and if an obj is a real example of a PEG grammar .

to formalize this: what kind of grammar and parser I need in order to read an obj file ?

3
  • why the downvote, I'm asking for help in order to define the family of grammars to which the obj file format belongs to. Jun 16, 2014 at 22:56
  • You've got an XY problem. You don't know how to do something, you're trying to ask about that, but you really need to read and ask about the fundamentals. There are many such questions on P.SE such as What is the responsibility or benefit of a Tokenizer?. You likely need to do a bit more research yourself on the subject and make sure you explain the question and your understanding to its fullest.
    – user40980
    Jun 17, 2014 at 0:08
  • @MichaelT I didn't even knew that the thing I was looking for was called "tokenizer"; in my experience if you read 10 articles about this you will find 10 mix of different words with slightly different meaning each single time. It's kinda frustrating for a newcomer when you read something that is supposed to be technical and you just realize that is probably not even properly written. For example the comment I wrote under the answer from ratchet-freak was about this kind of confusion . I did my researches, the problem is that I just got even more confused. Jun 17, 2014 at 0:18

1 Answer 1

1

Depends on how you look at it.

The syntax (line per line first few chars show what the line is) is simple and a regular language.

The kicker is how to verify the f lines, however when you are parsing you have a turing machine at your disposal and you should just focus on the regular part and step in with the higher level where needed.

7
  • ... so ... you mean starting from ... ? Can you make an example with ragel or something like that ? I don't understand what you mean with "simple and a regular language" maybe a real world example may help. Jun 16, 2014 at 23:11
  • 1
    @user2485710 you are asking about the Chomsky hierarchy... do you know what a regular language is?
    – user40980
    Jun 16, 2014 at 23:19
  • @MichaelT that wikipedia article doesn't talk about Turing machines until the last and biggest set of grammars. Apparently regular grammars do not need a Turing machine according to the information that I read from there. Is there a simpler a more effective way to put this ? A simpler definition ? Jun 16, 2014 at 23:24
  • @user2485710 Remember that in the hierarchy each grammar can recognize all languages in the lower tier grammar (context free can recognize regular for example) usually using some ridiculously simple construct that you can easily hook into with the higher level trickery Jun 16, 2014 at 23:34
  • @user2485710 the line itself is a rather basic regular language... what you do with the parts that you pull out with the regular language requires a full on turing machine to look up symbols from elsewhere in the file (or possibly doing multiple passes).
    – user40980
    Jun 16, 2014 at 23:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.