Skip to content

Help with assembly grammar #731

Answered by maxbrunsfeld
Timmmm asked this question in Q&A
Discussion options

You must be logged in to vote

Newlines are significant, but I'm not sure how to handle that. I had a look at the Python grammar but it uses an external C scanner and it looks pretty complicated and undocumented. Is there any way to handle newlines explicitly in grammar.js?

You can handle newlines in grammar.js too. The Go grammar does this for example. It can work even though newlines can also function as whitespace. The lexer will only produce a \n token in states where that token is valid.

How on earth do you deal with the C preprocessor, given that it means basically anything can appear anywhere?

The C preprocessor is tricky. I think you'll need to approximate it as if it were part of the same language by expli…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Timmmm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #731 on October 02, 2020 18:53.