Closed slonkazoid closed 6 months ago
How does your parser handle empty strings? I remember that was something I struggled with implementing my interpreter
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
How does your parser handle empty strings? I remember that was something I struggled with implementing my interpreter
the lexer handles them just fine
it keeps the state of whether it is "in" quotes or not, and it's not "in" quotes until the first non-quote character is hit. and when it hits a terminator character (currently ' ' | '\t' | '[' | ']' | '=' | '!' | '?' | ':'
) "outside" quotes or a line feed, it terminates the string
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
damn, same, into what language?
when it hits a terminator character (currently
' ' | '\t' | '[' | ']' | '=' | '!' | '?' | ':'
) "outside" quotes or a line feed, it terminates the string
what if the string itself contains one of these characters?
const const str1 = "hello,
world"!
equivalent to
const const str1 = "hello,\nworld"!
"hello" // single double quote
'hello' // single single quote
''hello'' // double single quote
""hello"" // double double quote
"'''hello'''" // mirrored pattern, this is as far as the spec goes
"'''hello''''' // by number of quotes, this is only implied in the spec
interpreted as:
"hello"!
'hello'!
''hello''!
""hello""!
"'''hello'''"!
"'''hello'''''"!
const const foo = "bar"!
const const baz = "{foo}₺"!
const const quux = '{foo}₺'!
all of these interpolate
backticks are allowed
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
damn, same, into what language?
js
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
damn, same, into what language?
js
fuck same, what language are you writing the transpiler in? i'm doing it in rust
const const str1 = "hello, world"!
equivalent to
const const str1 = "hello,\nworld"!
"hello" // single double quote 'hello' // single single quote ''hello'' // double single quote ""hello"" // double double quote "'''hello'''" // mirrored pattern, this is as far as the spec goes "'''hello''''' // by number of quotes, this is only implied in the spec
interpreted as:
"hello"! 'hello'! ''hello''! ""hello""! "'''hello'''"! "'''hello'''''"!
java const const foo = "bar"! const const baz = "{foo}₺"! const const quux = '{foo}₺'!
all of these interpolate
backticks are allowed
thank you for the clarification, this is going to be horrible to implement
👍, though I think this should be included in the README (maybe more explained)
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
damn, same, into what language?
js
fuck same, what language are you writing the transpiler in? i'm doing it in rust
typescript if you want to talk more I guess we can discuss in the discussion thread about dreamberd implementations
👍, as someone who is trying to make a dreamberd transpiler, this is very unclear currently
damn, same, into what language?
js
fuck same, what language are you writing the transpiler in? i'm doing it in rust
typescript if you want to talk more I guess we can discuss in the discussion thread about dreamberd implementations
sure, @ me in there
👍, though I think this should be included in the README (maybe more explained)
I think I'll add some official test suite or something
multiline strings
the current spec does not directly comment on multiline strings, but currently, strings can not be multiline due to AQMI:
i think multiline strings should be possible with backslash just before the LF
the above is how i currently implemented it, but it does not allow spaces after the backslash
quoting
my parser currently accepts the following as valid ways to quote a string:
though, i am not sure if the last one should be possible. if you could clarify this, it'd be appreciated
interpolation
should interpolation only be allowed in single double quote contexts? i feel like this is a good idea
backticks
no backticks?