<infinisil>
Yeah all edges would only be a transformation that maintains the final result
<infinisil>
Though I'm not doing graph traversal now, this would be way too complicated and leads to exponential time
<infinisil>
Just doing a stream-based transformation now, repeating it until the result doesn't change anymore
<MichaelRaskin>
Please no, drop one level of meta
<infinisil>
I could add one level of meta by implementing this in Nix itself!
<MichaelRaskin>
I mean, escapings are not _nodes_, escapings are _paths
<infinisil>
Not sure I get that
<MichaelRaskin>
Let's assume that escaping never requires _two_ nested (actual, unescaped) ${}
<MichaelRaskin>
Because if it does we are already summoning the dark spirits of madness
<MichaelRaskin>
Then validation of the code can be done by a finite automaton, right?
<MichaelRaskin>
And even more, interpretation can be done by a finite transducer
* infinisil
is lost
<infinisil>
I guess parsers are finite state machines yeah?
<infinisil>
Not sure where you're going
<MichaelRaskin>
Well, a full Nix parser cannot be a finite state machine
<infinisil>
Ah yes, not context free
<MichaelRaskin>
Context free is much larger than FSM, indeed
<MichaelRaskin>
But we are only interested in literal strings
<MichaelRaskin>
Escaped in a way that does not summon curious daemons from beyond.
<MichaelRaskin>
So we can consider a Nix sublanguage that is parseable by FSMs (i.e. regexps)
<MichaelRaskin>
Moreover, this parsing with finite memory can output the evaluated string on the fly (it has to be on the fly, there is no memory for the entire string!)
<infinisil>
Oh oh
<infinisil>
Parsing and regex in one sentence
<infinisil>
That summons demons already
<MichaelRaskin>
No.
<MichaelRaskin>
Parsing and regexps only summons Zalgo when you parse non-regular languages by regular expressions
<MichaelRaskin>
Because… well, in that case you don't really parse what you are supposed to parse
<MichaelRaskin>
Here we consciously restrict the language we allow.
<MichaelRaskin>
So we have Nix string literals where any interpolations must contain Nix string literals without interpolations
<MichaelRaskin>
This is a regular (sub)language so we can think in term of regular expressions or finite state machines
<MichaelRaskin>
Now we can consider a graph traversal problem. Each prefix of an input yields some characters of evaluated output, and some FSM state.
<MichaelRaskin>
Of course, if characters are not a prefix of desired result, we can just stop and fail
<MichaelRaskin>
So any prefix that has a hope has an effect described by how many correct characters it prints and what state it reaches
<MichaelRaskin>
Now this is a very linear-time problem.
<MichaelRaskin>
No exponential needed
<infinisil>
Hm I somewhat get it
<MichaelRaskin>
I could try to explain in more details, but then I would need to ask a lot of questions about your exact background
<infinisil>
,escape
<{^_^}>
Usage: ,escape <text> to show how to escape the given text in Nix
<infinisil>
Oh monty is gone
<infinisil>
,escape LAST_RET='${"${?#0}"}'
<{^_^}>
Escape this in '' strings with: LAST_RET=''\'''${"''${?#0}"}'
<{^_^}>
Escape this in " strings with: LAST_RET='\${\"\${?#0}\"}'
<MichaelRaskin>
infinisil++
<{^_^}>
infinisil's karma got increased to 292
hmpffff has joined #nix-lang
__monty__ has joined #nix-lang
kyren has left #nix-lang ["User left"]
__monty__ has quit [Quit: leaving]
__monty__ has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
ddellacosta has quit [Ping timeout: 265 seconds]
hmpffff has joined #nix-lang
__monty_1 has joined #nix-lang
__monty_1 has quit [Client Quit]
ddellacosta has joined #nix-lang
ddellacosta has quit [Ping timeout: 240 seconds]
ddellacosta has joined #nix-lang
ddellacosta has quit [Ping timeout: 260 seconds]
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
__monty__ has quit [Quit: nn]
tilpner has quit [Remote host closed the connection]