Assembly language patterns

View: New views
11 Messages — Rating Filter:   Alert me  

Assembly language patterns

by Edward K. Chew-2 :: Rate this Message:

| View Threaded | Show Only this Message

I just joined this list and seem to be having trouble posting, but  
I'll give it another try.

I was wondering what the prevailing wisdom is regarding pattern naming  
conventions for assembly languages.  I'm working on a bundle for an  
obscure chip (the long-discontinued Motorola DSP96002 which we still  
use in a variety instruments on account of it being one of the few  
DSPs which supports extended precision floats).  So far, I've got  
patterns like "assembly.opcode", "assembly.directive", and  
"assembly.directive.macro", but I'm not sure this is the way to go.  
Should these all be under "keyword", for example?

-Ted


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Luke Daley :: Rate this Message:

| View Threaded | Show Only this Message


On 05/04/2008, at 11:06 PM, Edward K. Chew wrote:

> I was wondering what the prevailing wisdom is regarding pattern  
> naming conventions for assembly languages.  I'm working on a bundle  
> for an obscure chip (the long-discontinued Motorola DSP96002 which  
> we still use in a variety instruments on account of it being one of  
> the few DSPs which supports extended precision floats).  So far,  
> I've got patterns like "assembly.opcode", "assembly.directive", and  
> "assembly.directive.macro", but I'm not sure this is the way to go.  
> Should these all be under "keyword", for example?

Hi Ted,

There is a page in the manual on this.

http://macromates.com/textmate/manual/language_grammars#naming_conventions

LD.

______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Edward K. Chew-2 :: Rate this Message:

| View Threaded | Show Only this Message

On 5-Apr-08, at 9:08 AM, Luke Daley wrote:

>
> On 05/04/2008, at 11:06 PM, Edward K. Chew wrote:
>
>> I was wondering what the prevailing wisdom is regarding pattern  
>> naming conventions for assembly languages.  I'm working on a bundle  
>> for an obscure chip (the long-discontinued Motorola DSP96002 which  
>> we still use in a variety instruments on account of it being one of  
>> the few DSPs which supports extended precision floats).  So far,  
>> I've got patterns like "assembly.opcode", "assembly.directive", and  
>> "assembly.directive.macro", but I'm not sure this is the way to  
>> go.  Should these all be under "keyword", for example?
>
> Hi Ted,
>
> There is a page in the manual on this.
>
> http://macromates.com/textmate/manual/language_grammars#naming_conventions
>
> LD.

Thanks, Luke.  I have looked at that page, and the existing  
conventions seem to cater mostly to compiled or scripted languages.  
Assembly languages are certainly varied, but do tend to share some  
common elements that could use their own naming scheme.

I notice under some of themes that shipped with TextMate, there are  
sub-categories not listed in the manual.  For example, there was one  
called "meta.preprocessor" in the Mac Classic theme.  For the time  
being, I am putting my directives there.  It's not a perfect fit,  
maybe, but at least it keeps them in a separate area from the opcodes,  
which I have under "keyword".

-Ted


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Gerd Knops-2 :: Rate this Message:

| View Threaded | Show Only this Message


On Apr 5, 2008, at 8:36 AM, Edward K. Chew wrote:

> On 5-Apr-08, at 9:08 AM, Luke Daley wrote:
>>
>> Hi Ted,
>>
>> There is a page in the manual on this.
>>
>> http://macromates.com/textmate/manual/language_grammars#naming_conventions
>>
>> LD.
>
> Thanks, Luke.  I have looked at that page, and the existing  
> conventions seem to cater mostly to compiled or scripted languages.  
> Assembly languages are certainly varied, but do tend to share some  
> common elements that could use their own naming scheme.
>
I had the same experience when adding a language definition for SX uC  
assembler. And if you make up your own, downside is that you will also  
need to add syntax highlighting to all themes you use.

Since I am not intending of making mine public, I kind of went  
backwards: In the preferences I looked how the various scopes were  
highlighted, and picked based on that, adding ".assembler" to all. I  
still had to make up a few to get the highlighting balanced. I am sure  
the language police would object strongly, but it works fine for my  
purposes.

Gerd


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Thomas Aylott - subtleGradient :: Rate this Message:

| View Threaded | Show Only this Message

Stay where you are! Infininight will be there to arrest you momentarily

On Apr 5, 2008, at 10:24 AM, Gerd Knops wrote:
> I am sure the language police would object strongly


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Joachim Mårtensson :: Rate this Message:

| View Threaded | Show Only this Message

> I just joined this list and seem to be having trouble posting, but
> I'll give it another try.
>
> I was wondering what the prevailing wisdom is regarding pattern naming
> conventions for assembly languages.  I'm working on a bundle for an
> obscure chip (the long-discontinued Motorola DSP96002 which we still
> use in a variety instruments on account of it being one of the few
> DSPs which supports extended precision floats).  So far, I've got
> patterns like "assembly.opcode", "assembly.directive", and
> "assembly.directive.macro", but I'm not sure this is the way to go.
> Should these all be under "keyword", for example?
While I am not an authorative person on the subject (I do get harassed by
Infininight ever so often ;) )
here are some suggestions:

assembly.opcode => keyword.control.assembly (Jump, Call, Load, Store etc)
perhaps ops such as add and multiply should be keyword.operator.assembly

assembly.directive.macro => support.function.macro.assembly

I would put registers under storage.type.register.assembly and labels
under entity.name.function.assembly. For example,

label: add r1, r2

in the above label would be the entity scope, r1 and r2 the storage.

Joachim Mårtensson



______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Tony Crockford :: Rate this Message:

| View Threaded | Show Only this Message


On 5 Apr 2008, at 14:06, Edward K. Chew wrote:
> I just joined this list and seem to be having trouble posting, but  
> I'll give it another try.

FYI - Gmail helpfully hides messages that are send from you, until  
someone replies - it assumes that any message to a list that you send,  
you know about, so it doesn't show you it again, which often means you  
(we, all gmail users) think you're post never made it onto the list.

not the best UI IMHO, but there you go...

;)

______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Edward K. Chew-2 :: Rate this Message:

| View Threaded | Show Only this Message

On 5-Apr-08, at 10:24 AM, Gerd Knops wrote:

On Apr 5, 2008, at 8:36 AM, Edward K. Chew wrote:
On 5-Apr-08, at 9:08 AM, Luke Daley wrote:

Hi Ted,

There is a page in the manual on this.

http://macromates.com/textmate/manual/language_grammars#naming_conventions

LD.

Thanks, Luke.  I have looked at that page, and the existing conventions seem to cater mostly to compiled or scripted languages.  Assembly languages are certainly varied, but do tend to share some common elements that could use their own naming scheme.

I had the same experience when adding a language definition for SX uC assembler. And if you make up your own, downside is that you will also need to add syntax highlighting to all themes you use.

Since I am not intending of making mine public, I kind of went backwards: In the preferences I looked how the various scopes were highlighted, and picked based on that, adding ".assembler" to all. I still had to make up a few to get the highlighting balanced. I am sure the language police would object strongly, but it works fine for my purposes.

Okay, well it sounds like there is no real consensus on assembly.  I guess I'll stick with what I've got, then, which currently looks like this:

meta.preprocessor.directive.assembly.Asm96002: assembler directives (e.g. dcb: define byte-level storage)
meta.preprocessor.function.assembly.Asm96002: functions evaluated at assemble-time (e.g. @cvs: convert memory space)
keyword.other.opcode.assembly.Asm96002: processor instructions (e.g. bclr: test and clear one bit)
variable.language.register.assembly.Asm96002: internal registers and their sub-fields
constant.numeric.assembly.Asm96002
string.quoted.single.assembly.Asm96002
comment.line.assembly.Asm96002

Here is an example of how it looks in the Mac Classic theme:


(Aside: I couldn't find any way to copy or save text with the formatting preserved and had to resort to a screen dump.  I guess I'll have to add rtf export to my wish list, along with multi-window projects, split views, and print selection.)

I have yet to decide what (if anything) to do with user-defined symbols. Should I try to distinguish between equates (constants), functions, and storage variables? That could be difficult. Maybe I'll cop out and come up with something generic like "label" that covers everything.

-Ted




______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Edward K. Chew-2 :: Rate this Message:

| View Threaded | Show Only this Message

On 5-Apr-08, at 11:16 AM, Joachim Mårtensson wrote:

>> I just joined this list and seem to be having trouble posting, but
>> I'll give it another try.
>>
>> I was wondering what the prevailing wisdom is regarding pattern  
>> naming
>> conventions for assembly languages.  I'm working on a bundle for an
>> obscure chip (the long-discontinued Motorola DSP96002 which we still
>> use in a variety instruments on account of it being one of the few
>> DSPs which supports extended precision floats).  So far, I've got
>> patterns like "assembly.opcode", "assembly.directive", and
>> "assembly.directive.macro", but I'm not sure this is the way to go.
>> Should these all be under "keyword", for example?
> While I am not an authorative person on the subject (I do get  
> harassed by
> Infininight ever so often ;) )
> here are some suggestions:
>
> assembly.opcode => keyword.control.assembly (Jump, Call, Load, Store  
> etc)
> perhaps ops such as add and multiply should be  
> keyword.operator.assembly
>
> assembly.directive.macro => support.function.macro.assembly
>
> I would put registers under storage.type.register.assembly and labels
> under entity.name.function.assembly. For example,
>
> label: add r1, r2
>
> in the above label would be the entity scope, r1 and r2 the storage.

Wow, you have a very different take on it.  I will definitely consider  
your approach...

-Ted


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by Edward K. Chew-2 :: Rate this Message:

| View Threaded | Show Only this Message

On 5-Apr-08, at 12:42 PM, Tony Crockford wrote:

>
> On 5 Apr 2008, at 14:06, Edward K. Chew wrote:
>> I just joined this list and seem to be having trouble posting, but  
>> I'll give it another try.
>
> FYI - Gmail helpfully hides messages that are send from you, until  
> someone replies - it assumes that any message to a list that you  
> send, you know about, so it doesn't show you it again, which often  
> means you (we, all gmail users) think you're post never made it onto  
> the list.
>
> not the best UI IMHO, but there you go...
>
> ;)

Ah.  To think they must have gone to some trouble to come up with a  
feature like that...

-Ted


______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate

Re: Assembly language patterns

by peterdc :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, Apr 5, 2008 at 10:03 AM, Edward K. Chew <ekchew@...> wrote:
>
> On 5-Apr-08, at 10:24 AM, Gerd Knops wrote:
>
>
> On Apr 5, 2008, at 8:36 AM, Edward K. Chew wrote:
> On 5-Apr-08, at 9:08 AM, Luke Daley wrote:
>
[...]
> (Aside: I couldn't find any way to copy or save text with the formatting
> preserved and had to resort to a screen dump.  I guess I'll have to add rtf
> export to my wish list, along with multi-window projects, split views, and
> print selection.)

See the Create HTML from Document command in the TextMate Bundle

______________________________________________________________________
For new threads USE THIS: textmate@...
(threading gets destroyed and the universe will collapse if you don't)
http://lists.macromates.com/mailman/listinfo/textmate