corth-lang / Corth

A self-hosted stack based language like Forth
MIT License
7 stars 1 forks source link

String format characters #2

Open HuseyinSimsek7904 opened 1 year ago

HuseyinSimsek7904 commented 1 year ago

String format characters should be implemented. These will change how the compiler will interpret the string. Characters in after the terminal double quote are called format flags. These flags can be:

"hello, world\n"c -> Pushes only the address not the length, like a C string.
"hello, world\n"n -> Does not append a null-terminator '\0' at the end.
"hello, world\n"l -> Also counts the null-terminator when pushing the length of the string, 'c' and 'l' or 'n' can not be used together.
"hello, world\n"p -> Ignores escape sequences and directly saves the string.

Note: Some or all of these may lose their use after structs are implemented.