|Using Lex to scan a processor specific Assembly Language firstname.lastname@example.org (2000-12-20)|
|Re: Using Lex to scan a processor specific Assembly Language email@example.com (Joachim Durchholz) (2000-12-21)|
|Date:||20 Dec 2000 17:22:44 -0500|
|Posted-Date:||20 Dec 2000 17:22:43 EST|
I am in the process of writing a scanner that scans an assembly
language that was written for a specific processor. This language is
very old, and the current assembler has some issues that need to be
I am having trouble figuring out how to scan for comments in the file.
A comment can start with a star, which is easy enough, "*"[^\n]*
But text in the fourth column of the file is also considered a
comment. And this type of comment does not start with any kind of
special character like the '*'. Here is an example:
label Operator op1,op2 Comment
So I am really confused about how to throw away this type of comment
for the yacc parser. How can I write a regular expression to catch a
comment that is not associated with a '*' or something.
[Basically, you can't. I suspect you can use start states and some
whitespace counting hackery to switch into a state after the operands
that swallows up the rest of the line. -John]
Return to the
Search the comp.compilers archives again.