Talk:Precognition

From Esolang
Jump to navigation Jump to search

Questions about the specs

  1. Why don't you separate the initial sring from the parts by a part separator ; , and perhaps distinguish type I parts by a trailing rule break? You only have one initial string per program, not one per part, so that seems more logical. You'd then need some way to disambiguate between parts and initial string, eg. make the initial string required, or make an empty last part invalid, or require writing an empty initial string as eg. |
  2. Can you clarify on how rules are preprocessed if metacharacters appear in them? Here's how I imagine this works but please tell if that's not what you're thinking?
    1. First, add meta-parenthesis around balanced brackets in each of the match and the replacement.
    2. Second, turn the match and replacement to parse trees using the precedence rules and meta-parenthesis.
    3. Third, preprocess the rule by copying the whole rule for each possible value of the six wildcards .'"_-= , with each kind of wildcard standing for the same string in the entire rule, and adding meta-parenthesis around the substituted string.
    4. Fourth, copy the whole rule for each possible choice made for the !?+*|. This time the choice is made separately for each instance of the operators, and from outside in, so that in (a*b)*, each repeat of a*b can choose different numbers of repetition counts of a.
    5. Fifth, resolve each &# operator by dropping the rule if its sides don't match. At this point the two sides of &# only contain concatenations and characters, and they will be compared as a string, not as a tree.
    6. How does the ~ operator work? Do you disambituate its meanings between the first and second step, then apply it in the fourth step?
  3. Is the example “a~b~d~e” supposed to say “a!b!d!e” ?
  4. Why don't you add implicit concatenation to the precedence table, between + and & , to make it easier to understand?
  5. What does “part” mean in any “parts of the data string which were produced by a replacement in this round cannot themselves be replaced until the next round”? Is it only characters? Or would an empty string as the replacement block matching a sequence of characters if some of them are before and some are after that position?

b_jonas 15:09, 24 October 2018 (UTC)

  1. Huh? The initial string is separated from the parts by a part separator. It's just that it's possible that there won't be one at all. (The method of signifying Type I / Type II distinction is taken from one of the predecessor languages I was working on, although in that language they were the other way round; I swapped it because Type II is likely to be much more common.)
  2. The algorithm you give would take an infinite length of time, but it's correct in that it should produce the right results if it does run (presumably you'd run it in parallel with other things). ~ disambiguates by looking to see if it's next to literal lexemes.
  3. Yes, a~b~d~e doesn't make any sense (d~e cannot resolve to a number unless you're using a number system like hexadecimal), and a!b!d!e is almost certainly what I meant.
  4. Good idea.
  5. I didn't think of that (it didn't come up in any of the situations that inspired that rule). Logically speaking, though, it seems consistent for an empty string replacement to block matches until the next round.
--ais523 17:43, 24 October 2018 (UTC)