gnupic: Re: [gnupic] SPASM - a MPASM behave alike


Previous by date: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, David Barnett
Next by date: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, Peter Keller
Previous in thread: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, David Barnett
Next in thread: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, Peter Keller

Subject: Re: [gnupic] SPASM - a MPASM behave alike
From: David Barnett ####@####.####
Date: 7 Jun 2009 00:20:59 -0000
Message-Id: <4d52f78b0906061720heeced6bnb14d1ed62034c660@mail.gmail.com>

On Sat, Jun 6, 2009 at 7:58 PM, Peter Keller ####@####.#### wrote:

> Is there a formal lexical & grammar specification for the assembly
> dialect? And, in a sense, why bother having a preprocessor phase
> at all? Just lex and parse the entirety of the language, macros and
> all into an AST, and then transform the AST into another AST with the
> "preprocessing" steps applied.

Macros and directives are tricky because they work in terms of text
substitution. So while you could go directly to an AST, you'd probably need
to dip back into a textual representation for several things, and in most
cases that would defeat the purpose of goint straight to an AST. For
instance, in PIC assembler you can do #v substitution in the middle of
symbol names, or you can #define multiple arguments at once (e.g. "PORTB,
2"), so before the preprocessor stage the "syntax" is very loose and doesn't
make a good AST, IMO.

The problem with gpasm's "two pass" system is that it's sloppy about how it
does the substitutions, and it does too much in the lexer. That makes it
nearly impossible to do some things we need. For instance, if the
indentation is wrong in the assembler syntax, gpasm gets completely tripped
up and gives very strange errors because the lexer has to assume that
anything in column 1 is a directive or label, without checking whether it
corresponds to an opcode instead.

David

Previous by date: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, David Barnett
Next by date: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, Peter Keller
Previous in thread: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, David Barnett
Next in thread: 7 Jun 2009 00:20:59 -0000 Re: [gnupic] SPASM - a MPASM behave alike, Peter Keller


Powered by ezmlm-browse 0.20.