How would you recommend implementing and upstreaming an assembly parser? #5485
Replies: 3 comments 2 replies
-
Specifically for nvim-treesitter, I would look at current filetype detection; it's easy to assign a parser to a filetype, but if there's no dedicated filetype, it's very difficult. |
Beta Was this translation helpful? Give feedback.
-
Update: I found a good resource on this topic: https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L407 Though the list above may not be 100% convention it's probably a good estimation about which extensions developers use for which assembly languages. I went through all of the assembly file types and noted these conflicts: h2. File Extension Conflicts:
"Unix Assembly" and "Motorola 68K Assembly"
Luckily there's less overlap than I'd thought. Depending on how it's done, it may even be possible to have 1 parser that handles more than one convention. Then the minimal conflicts wouldn't be an issue in any case since the parser can read the files either way. Here's the full list of assembly extensions if anyone's curious. Note that duplicates indicate "there was more than one parser that subscribed to this file extension" (a conflict) All extensions
|
Beta Was this translation helpful? Give feedback.
-
My recommendation would be to look at the GCC file type conventions (here). This adds |
Beta Was this translation helpful? Give feedback.
-
I'm thinking of writing an assembly parser and if I did write it I thought maybe to upstream it to nvim-treesitter since my first parser was added pretty easily (thanks to the maintainers for that, btw).
But assembly comes in several different flavors. There's AT&T Intel, and ARM of course but even lesser known Motorola Assembly which has its own syntax.
Would an assembly parser have to be fully generic for all of these flavors? Surely not, right? If so, how would someone recommend upstreaming it to Neovim? Would it end up being added as "asm_intel" for one flavor and "asm_foo" for others? Some thoughts on this would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions