flat assembler
Message board for the users of flat assembler.
Index
> IDE Development > TABLES.INC token classifier |
Author |
|
hopcode 03 Apr 2013, 05:56
yeap useful i did it till now regex+sort(because of MASM/NASM merging too). i think i will output the class dictionary using it for geshi and scintilla. lexer in scintilla has few awareness of fasm syntax. it's simple to tweak it but i didnt do it because i am a bit lazy. i think the code above may stay in the example section because it works essentially as a tokenizer for macro-languages. invoking fasm more times on midlle-stage-inputs till to the last stage outputting the executable.
_________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
03 Apr 2013, 05:56 |
|
hopcode 04 Apr 2013, 16:29
Keep It Simple Stupid ?
Code: sect equ line equ 0 macro dw [arg]{} macro db arg1,arg2,[args]{ if arg1 eqtype 0 if arg2 eqtype '' display arg2,13,10 else if arg2 eqtype 0 if sect eq symbol_characters ;--- display_hex arg1 ;--- display_hex arg2 match a,args\{ display \a ;--- hex for 9,0Ah,0Dh,1Ah,20h \} display 13,10 end if end if else if arg1 eqtype '' display arg1,13,10 end if } macro @output arg{ local a macro arg a\{ sect equ arg display `arg,13,10 \} } @output symbol_characters @output preprocessor_directives @output macro_directives @output operators @output single_operand_operators @output directive_operators @output address_sizes @output symbols_2 @output symbols_3 @output symbols_4 @output symbols_5 @output symbols_6 @output symbols_7 @output symbols_8 @output symbols_9 @output symbols_10 @output symbols_11 @output symbols_12 ;--- doesent exist, test @output instructions_2 @output instructions_3 @output instructions_4 @output instructions_5 @output instructions_6 @output instructions_7 @output instructions_8 @output instructions_9 @output instructions_10 @output instructions_11 @output instructions_12 @output instructions_13 @output instructions_14 @output instructions_15 @output instructions_16 ;--- doesent exist @output data_directives_2 @output data_directives_3 @output data_directives_4 virtual at 0 include "tables.inc" end virtual output Code: flat assembler version 1.71.09 (1048576 kilobytes memory) symbol_characters ;<--- here should display hex ------------ +-/*=<>()[]{}:,|&~#`;\ preprocessor_directives define include irp irps macro match purge rept restore restruc struc macro_directives common forward local reverse operators + - * / and mod or shl shr xor single_operand_operators + - not plt rva directive_operators align as at ;---- follows .... it may count lines too! its so K.I.S.S as to deserve the XML format Cheers, _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
04 Apr 2013, 16:29 |
|
bitRAKE 04 Apr 2013, 20:06
Here are the exceptions/notes I have collected:
Code: not in TABLES.INC: - FIX EQU - @@ @B @F @R %T PREPROCESSOR - MACRO, only valid inside of {} OPERATOR - instruction - and or shl shr xor not - directive - align - address SYMBOL - REGISTER - MODIFIER (type, directive) INSTRUCTION - DIRECTIVE DATAD _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup Last edited by bitRAKE on 05 Apr 2013, 00:20; edited 1 time in total |
|||
04 Apr 2013, 20:06 |
|
baldr 04 Apr 2013, 21:54
bitRAKE,
In a macro language like fasm provides, probably the only thing you can be sure about is that in «a fix b» a is a symbol, fix is the directive and b is a replacement for a. Everything else requires preprocessing (except comments, of course ). To stay on topic, equ is not in TABLES.INC too. |
|||
04 Apr 2013, 21:54 |
|
bitRAKE 05 Apr 2013, 00:20
Too bad we can't "f fix fix" to save a few characters. Even crazy stuff like:
Code: \%?$ fix macro \%?$ a b{db b} Code: C fix ; dnl fix ; C This type of comment syntax is not valid in FASM. C Macro for AT&T syntax not possible. ; Of course, macro works (kind of): macro C d {} macro dnl d {} Thanks for the reminder of EQU. Having a concise list will speed future adaption of the syntax. We should make an obfuscator that packs source codes to minimal bytes which still compile into original target, lol. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
05 Apr 2013, 00:20 |
|
hopcode 05 Apr 2013, 03:06
obfuscator... is interesting idea, because considering on-line http compilation it may be very useful to reduce bandwidth. it contains the syntax, it doesent need decompression. client sends, i estimate 1/3 -> 1/5 source stuff, to server. on the server side, diff will be simpler to keep it updated.
_________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
05 Apr 2013, 03:06 |
|
hopcode 05 Apr 2013, 09:02
baldr wrote: bitRAKE,probably the only thing you can be sure about is that in «a fix b» a is a symbol, fix is the directive and b is a replacement for a. Everything else requires preprocessing (except comments, of course ). i'll show you something. your comments here very well appreciated Code: da equ db comm equ ; da 1 comm fix \; comm aaaaaaa output Code: E:\old_tests_x64lab>fasm equ_test.asm flat assembler version 1.71.09 (1048576 kilobytes memory) 1 passes, 1 bytes. E:\old_tests_x64lab> Cheers, _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
05 Apr 2013, 09:02 |
|
baldr 05 Apr 2013, 10:03
hopcode wrote: your comments here very well appreciated
|
|||
05 Apr 2013, 10:03 |
|
hopcode 05 Apr 2013, 10:49
yes, as expected. i was "speculating" about equ above. it should have lower or equal priority than fix. then i was searching for something repetitive without brackets {}
Code: comm fix times 0 \; comm 1 comm db 10 comm aaaaa output seems ok. legal ? i think yes. my initial point was about comm equ times 0 \;. and this last works too. what do you think ? _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
05 Apr 2013, 10:49 |
|
baldr 05 Apr 2013, 16:55
hopcode,
Yes, it works (but probably not as you think): first line is concatenated with second (I'm out of guesses why you're doing so), comm fix times 0 comm 1, while looking somewhat strange, successfully neutralize anything at assembler stage, provided it's used as a first token (after optional labels, naturally). I think simple ; is better. |
|||
05 Apr 2013, 16:55 |
|
hopcode 06 Apr 2013, 02:51
yes, ; works better in most cases! i am collecting/illustrating the syntax by simple examples and descriptions. thank you for your huge patience.
Cheers, _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
06 Apr 2013, 02:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.