Basic question about creating a parser

Eric Abrahamsen <[email protected]> Mon, 20 Mar 2017 09:40:44 -0700
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
[I tried to send this to the gmane.emacs.cedet group, but it didn't
appear there, hope this is a more appropriate channel.]

I've been working on a parser for vcard files, using regular
expressions. It's going fine, but it just feels brittle and unpleasant.

The vCard format comes with an ABNF, I guess[1]. I've never worked with
lexers/parsers before, but my assumption is that I could convert this
ABNF to a language grammar, and the make a parser that would turn a
vCard text file into some sort of lisp structure, which I could then go
on to work with.

I've tried out the semantic and bovine manuals, and they assume a bit
more basic knowledge than I've got.

Can anyone let me know if semantic is at all an appropriate tool for
this job? The grammar is dead simple: header, footer, and each line is a
key-plus-value-plus-parameters deal, that's all there is to it.

All I really want is to munch text files and produce some sort of
structured result. Though, come to think of it, if this could then be
used to make a vcard-mode, that would be great.

Any pointers very welcome!

Eric


[1]: https://tools.ietf.org/html/rfc6350

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot