Post 368483 by fasterthanlime@mstdn.io
(DIR) More posts by fasterthanlime@mstdn.io
(DIR) Post #366345 by jk@mastodon.social
2018-10-04T18:13:53Z
0 likes, 0 repeats
whats the best C library for parsing/lexing C code, e.g. for something akin to syntax highlighting
(DIR) Post #366349 by WAHa_06x36@mastodon.social
2018-10-04T18:14:12Z
0 likes, 0 repeats
@jk Probably clang?
(DIR) Post #366351 by bonzoesc@m.bonzoesc.net
2018-10-04T18:14:16Z
0 likes, 0 repeats
@jk some llvm/clang components?
(DIR) Post #366356 by BenLubar@mastodon.social
2018-10-04T18:14:35Z
0 likes, 0 repeats
@jk if you want to pull in all of GCC, go for that.If you're just doing syntax highlighting, you can probably get away with a few regular expressions and not actually parsing it at all.
(DIR) Post #366365 by jk@mastodon.social
2018-10-04T18:15:40Z
0 likes, 0 repeats
@BenLubar i think i am looking for something between the two extremes. maybe ill spend hours lookin on github for someone's "i put a lot of regular expressions together into a thing and also there are tests" with the most stars
(DIR) Post #366374 by BenLubar@mastodon.social
2018-10-04T18:16:27Z
0 likes, 0 repeats
@jk if you can find a C formatter, that's probably going to have what you want in its code.
(DIR) Post #366429 by Efi@mastodon.social
2018-10-04T18:20:47Z
0 likes, 0 repeats
@jk gcc uses a hand-written lexer, so I'm not sure what the right answer is to this
(DIR) Post #366606 by ddipaola@cybre.space
2018-10-04T18:39:42Z
0 likes, 0 repeats
@jk tcc ;)
(DIR) Post #368309 by fasterthanlime@mstdn.io
2018-10-04T20:54:19Z
0 likes, 0 repeats
@jk maybe a subset of gtksourceview is worth looking at https://developer.gnome.org/gtksourceview/stable/alternatively, using a PEG grammar (I'm sure there's a few floating around), lighter but probably a lot more involved
(DIR) Post #368483 by fasterthanlime@mstdn.io
2018-10-04T20:56:34Z
0 likes, 0 repeats
@jk see https://github.com/pointlander/peg/blob/master/grammars/c/c.pegAndhttp://piumarta.com/software/peg/
(DIR) Post #368484 by jk@mastodon.social
2018-10-04T21:07:51Z
0 likes, 0 repeats
@fasterthanlime this is helpful, thanks!
(DIR) Post #368693 by fasterthanlime@mstdn.io
2018-10-04T21:20:11Z
0 likes, 0 repeats
@jk good luck!