flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 09 Sep 2024, 12:46
Leading dot can be captured:
Code: calminstruction ? line& match =.any,line jyes directive ; assemble line ; forward stringify line display line display 10 exit directive: stringify line display 9 display "DIRECTIVE: " display line display 10 end calminstruction There is no automatic way to interpret numbers as octal - it would require parsing and base conversion from decimal to octal, or character by character conversion. It is possible though. |
|||
![]() |
|
TimUr 09 Sep 2024, 12:54
bitRAKE wrote: Leading dot can be captured: Thanks! Good example. |
|||
![]() |
|
bitRAKE 09 Sep 2024, 13:00
There is some nuance: for example, you could allow spaces between the dot and the directive by changing the match: "match =. any,line" -- putting a space after the dot. It all depends on the language you want to support.
|
|||
![]() |
|
revolution 09 Sep 2024, 13:04
bitRAKE wrote: There is no automatic way to interpret numbers as octal - it would require parsing and base conversion from decimal to octal, or character by character conversion. It is possible though. |
|||
![]() |
|
bitRAKE 09 Sep 2024, 13:15
revolution wrote: Couldn't it add a trailing o if no other suffix is present, then let the engine do the conversion? Edit: I'm just being extremely pedantic and making no assumption about the target language. The match directive can't disambiguate number forms (ex. $00, 0x00, 00o, 0_0b), and fasm[g]'s number forms are more advanced than most languages. |
|||
![]() |
|
Tomasz Grysztar 09 Sep 2024, 17:02
bitRAKE wrote: Leading dot can be captured: As for the custom number formats, there's been this old example: https://board.flatassembler.net/topic.php?p=190479#190479 Certainly could be improved with CALM. |
|||
![]() |
|
bitRAKE 09 Sep 2024, 19:28
This will allow END: label:
Code: calminstruction END line& ; allow partial directive label local any arrange any, match :any?,line jyes label arrange line,=END line assemble line exit label: arrange line,=label =END assemble line assemble any end calminstruction Code: macro ? line& match =END? : rest, line match lead : rest, line label lead rest end match else match =END? :, line match lead :, line label lead end match else line end match end macro Code: calminstruction ? line& local rest arrange rest, match =END? : rest?,line jyes label assemble line ; forward exit label: match lead : rest?,line arrange line,=label lead assemble line assemble rest end calminstruction |
|||
![]() |
|
Tomasz Grysztar 10 Sep 2024, 09:50
bitRAKE wrote: ... perhaps there is a better way. Code: ?END: And there is also the old detached namespace trick that allows to reclaim all the keywords. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.