text stringlengths 81 47k | source stringlengths 59 147 |
|---|---|
Question: <p>Currently I am working on getting lots of html code and its related css, via id or class name. Once I have enough data to work with I am unsure how it would be easiest for any model to learn what css should be generated for each element.</p>
<p>My idea is to make a script to extract all html elements from... | https://cs.stackexchange.com/questions/120408/good-ai-model-for-learning-to-write-code-specifically-generate-css-from-any-giv |
Question: <p>For a school project, I'm planning to compare Spiking Neural Networks (SNNs) and Deep Learning recurrent neural networks, such as Long Short Term Memory (LSTMs) networks in learning a time-series. I would like to show some case where SNNs surpass LSTMs. Consequently, what are the limitations of LSTMs? Are ... | https://cs.stackexchange.com/questions/53552/what-are-the-limitations-of-rnns |
Question: <p>I start to suspect this problem is very hard now that I cannot find a single relevant literature on the subject, but it's too late to change the class project topics now, so I hope any pointers to a solution. Please pardon the somewhat artificial scenerio of this question, but here goes:</p>
<p>Technical ... | https://cs.stackexchange.com/questions/22666/neural-network-noisy-temporal-sequence-converter-transducerproducer-on-dema |
Question: <p>I recently started to learn about machine learning. I have created a feed forward neural network (ffnn) and a recurrent neural network (rnn) to predict user ratings of movies. I am using a subset of 2000 users and their ratings of the "Netflix Prize" dataset.</p>
<p>The ffnn as well as the rrn have an acc... | https://cs.stackexchange.com/questions/88401/machine-learning-for-recommendation-systems-feed-forward-and-recurrent-neural-n |
Question: <p>Yes, this is a quiz question. It's from a self-paced course, but the answer just isn't correct to me no matter how I look at it. There isn't really an active community to consult. </p>
<p>My Regular Expression experience is profoundly in JavaScript and I'm concerned that it poisoned my thinking of Regular... | https://cs.stackexchange.com/questions/84928/tokenization-problem |
Question: <p>I'm trying to create simple tokenizer to transform following (only part shown) search expression to tokens</p>
<pre><code>word1 near(1) word2
</code></pre>
<p>where word1, word2 are some words and near(1) is distance operator.
The question is how this expression should be tokenized.
I see two ways</p>
... | https://cs.stackexchange.com/questions/13418/tokenizer-and-complex-operators |
Question: <p>I'm trying to solve a problem from one of the older exams.</p>
<p>Question:</p>
<blockquote>
<p>There's an infinite, one-dimensional board, with fields numbered consecutively <span class="math-container">$\ldots, -2, -1, 0, 1, 2, \ldots$</span>
A move in the game consists of selecting a field and placing a... | https://cs.stackexchange.com/questions/164880/amortised-cost-transferring-tokens |
Question: <p>Is it valid to have the token split up, in a parser; as shown in the below grammar:</p>
<pre><code>expr -> expr addop term
term -> term mulop factor
factor -> factor digit | digit
addop -> + | -
mulop -> * | /
digit -> 0 | 1 | ... | 9
</code></pre>
<p>Say, for the arithmetic e... | https://cs.stackexchange.com/questions/161493/can-parser-split-tokens |
Question: <p>I am studying Compiler Design. The instructor told us that when a program is given to lexical analyzer it find all tokens then a symbol table is created and it is updated at every phase accordingly, but I read this online <a href="https://www.radford.edu/%7Enokie/classes/380/phases.html" rel="nofollow nore... | https://cs.stackexchange.com/questions/142035/how-are-lexical-tokens-produced |
Question: <p>I am reading Programming Language Pragmatics by Michael Scott. He says that on a first pass, a compiler will break a program into a series of tokens. He says that it will check for malformed tokens, like 123abc or $@foo (in C). </p>
<p>What is a malformed token? A variable that does not meet the rules of ... | https://cs.stackexchange.com/questions/3278/what-is-a-malformed-token |
Question: <p>I'm having problems finding an algorithm to the following problem:</p>
<p>A and B take turns replacing a number <span class="math-container">$n$</span> of tokens with either <span class="math-container">$floor((n+1)/2)$</span> or <span class="math-container">$n-1$</span>. The player who makes <strong>one<... | https://cs.stackexchange.com/questions/120051/algorithm-for-token-replacement-game |
Question: <p>I know a lot of computer languages and they all use tokens. E.g. in very early BASIC you could say <code>LET answer = 42</code>, which is composed of seven tokens, <code>LET</code>, <code>answer</code>, <code>=</code>, <code>42</code>, and three space tokens.</p>
<p>It seems that every character must be p... | https://cs.stackexchange.com/questions/81412/are-there-any-languages-without-tokens |
Question: <p>Say i have code snippet like --> </p>
<p>m -= n;</p>
<p>is <strong>minus</strong> and <strong>assignment</strong> considered as a single token or they will be considered as different token?</p>
<p>So the total token count will be 4 or 5?</p>
Answer: <p>In the C language you cant insert space between '-... | https://cs.stackexchange.com/questions/111752/doubt-on-token-in-compiler-design |
Question: <p>I'm a bit confused about the concept of finite state automata (FSA) and regular expression (RE) in lexical analysis. I have reading some books about compiler construction. At the part of tokenization, all the books I read talk about the regular expression first to recognize the tokens. For example, the re... | https://cs.stackexchange.com/questions/84560/do-we-need-regular-expression-first-or-finite-state-automata-in-lexical-anlysing |
Question: <p>i have a context free grammar </p>
<p>i want to create a tokens from the language </p>
<p>is there any techniques to do that ? </p>
<p>for example , this CFG from Prof.Alex Aiken notes : </p>
<pre><code> D -> D ; P | D
D -> def id(ARGS) = E ;
ARGS -> id, ARGS | id
E -> int | id | if E... | https://cs.stackexchange.com/questions/67961/how-to-create-tokens-from-cfg |
Question: <p><strong>number -> digits(.digits)?(E[+ -]?digits)?</strong>
This transition diagram runs the above mentioned token I can not understand this how this is work.what is meaning of "?"Symbol and digits. can anyone explain me this</p>
<p><a href="https://i.sstatic.net/Rxc5U.png" rel="nofollow noreferrer"><im... | https://cs.stackexchange.com/questions/100705/transition-diagram-for-following-token-number |
Question: <p>I have a grammar which is mostly <code>LL(1)</code>, save for the fact that some tokens may be promoted to larger integer types.</p>
<p>For example, let take the following grammar</p>
<pre><code>S ::= terminal1 S1
S1 ::= integer_16 S2 | integer_32 S3
</code></pre>
<p>where <code>S2</code> and <code>S3</cod... | https://cs.stackexchange.com/questions/154435/grammar-where-tokens-can-be-transmuted |
Question: <p>I have a problem that asks me to consider the string abbbaacc. I'm supposed to figure out which of the following lexical specification produces the tokenization ab/bb/a/acc.</p>
<p>The options are:</p>
<pre><code>A.
a(b+c)*
b+
B.
ab
b+
ac*
C.
c*
b+
ab
ac*
D.
b... | https://cs.stackexchange.com/questions/103658/product-of-lexical-specification |
Question: <p>I'm currently studying compiler construction book "Compilers Principles, Techniques, and Tools (2nd Edition)" , in page <a href="https://books.google.com.pk/books?id=kLVv4MSa7EUC&pg=PA113&lpg=PA113&dq=%3Cid,%20pointer%20to%20symbol-table%20entry%20for%20M%3E%20%3Cmult%20op%3E%20%3Cid,%20pointer... | https://cs.stackexchange.com/questions/47708/what-is-token-type-in-lexical-analysis |
Question: <p>I'm facing the following problem. I have a flat-file database (e.g. CSV).
Since it's relatively large to store in memory, I'd like to compress it.</p>
<p>Given a key, I need to return the uncompressed text (record of values).</p>
<p>So one naive idea is to tokenize the text into <strong>words</strong> an... | https://cs.stackexchange.com/questions/123604/on-the-fly-decompress-a-flat-file-database |
Question: <p>I have a list of supported operators, my question is whether the lexer should just yield the token for the operator or raise a syntax error in case that particular operator (let's say "?") doesn't exist in the operators list?</p>
<p>for example, the operators list [+, -]. for the expression "... | https://cs.stackexchange.com/questions/145273/should-a-lexer-tokenizer-handle-unknown-operators |
Question: <p>Let's start with the question. Say I have a C language statements follows</p>
<ol>
<li><p>it 458cat 2.01 = 96.87abc a.2 ;</p>
<p>-my question is how many tokens are there in the above statements. Secondly does white space like tabs, newline, makes a token or not? </p></li>
<li>If you are interested in m... | https://cs.stackexchange.com/questions/97180/counting-tokens-in-compilers-lexical-analyser |
Question: <p>A month ago, I asked the following question math.exchange (<a href="https://math.stackexchange.com/questions/3127874/morphing-hypercubes-and-odd-permutations">https://math.stackexchange.com/questions/3127874/morphing-hypercubes-and-odd-permutations</a>), but for completeness, I will include the details her... | https://cs.stackexchange.com/questions/107018/morphing-hypercubes-token-sliding-and-odd-permutations |
Question: <p>By token I mean the smallest element of source data, that the compression algorithm works on. It may be a bit (like in DMC), a letter (like in Huffman or PPM), a word, or variable-length string (like in LZ). </p>
<p>(Please feel free to correct me on this term, if I use it incorrectly.)</p>
<p>I'm thinki... | https://cs.stackexchange.com/questions/109160/how-to-find-optimal-token-set-for-compression |
Question: <p>I am using C++03. I have a stream of chars and I need to find the first token from a group of tokens. That is, I need to find the lowest indexed match. Specifically, the stream is just an char array, and the tokens of interest are listed below. The start of a token can occur anywhere in the stream (and not... | https://cs.stackexchange.com/questions/113376/find-first-occurence-of-multiple-tokens-using-c |
Question: <p>Unable to find out how the C-language lexical analyzer would tokenize the declaration of a static array. Say, int i[3]= {1,2,3};</p>
<p>The lexical analyzer would need to differentiate between just an integer identifier i, and a static array of size 3.</p>
<p>Am confused how the lexical analyzer would toke... | https://cs.stackexchange.com/questions/161252/c-language-tokenizer-output-for-static-integer-array |
Question: <p><a href="https://i.sstatic.net/vKd0k.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vKd0k.png" alt="enter image description here"></a>
This DFA is a token scanner for a programming language.I would like to add keywords of the programming language(if,else,end ... etc) in the DFA so the lexic... | https://cs.stackexchange.com/questions/101648/token-scanner-for-programming-languagelexical-analysis |
Question: <p>Trying to construct the full tree for a 9 game token of Nim and am slightly confused. I don't understand how two players, min and max, will make their pick. For example, max picks first and can only pick [9]. Min then picks from [8-1], [7-2], [6-3], and [5-4]. How does min calculate it's utility value her... | https://cs.stackexchange.com/questions/53745/a-9-token-game-of-nim-tree-construction |
Question: <p>I am to parse through a series of strings with a given token list. I was wondering if my lexical analysis is correct.</p>
<pre><code>T1 = { abc, abc1 }
T2 = { abd, abd1 }
ID = [a-z]+[a-z0-9]
NUM = 0 | [1-9][0-9]
</code></pre>
<p><code>lexer.getToken()</code> will return the current token and advance the in... | https://cs.stackexchange.com/questions/148929/lexical-analysis-on-a-series-of-tokens-given-regexes |
Question: <p>I'm searching for an algorithm but struggle to find anything, as I'm not sure how to formulate it correctly. I created a simple survey app in Angular with 24 questions and each has 2-5 answers. When the user answered all the questions I'd like to give him a token (as short as possible) on the result page t... | https://cs.stackexchange.com/questions/128215/algorithm-to-generate-a-token-as-survey-summary |
Question: <p>A lot of AI hardware coming out lately has its performance mentioned in TOPS i.e trillion operations per second.</p>
<p>Does anyone have an Idea how to estimate the llm performance on such hardware in tokens per second.</p>
<p>for example I have a hardware of 45 TOPS performance.
if I perform inferencing o... | https://cs.stackexchange.com/questions/167711/tops-trillion-operations-per-second-to-tokens-per-second |
Question: <p>Let $G=(V, E)$ be an unweighted and undirected graph, and $s, t \in E$. </p>
<p>The problems starts with $n$ tokens on $s$. </p>
<p>The goal is to move theses tokens to $t$ in a minimum of rounds with these rules :</p>
<ul>
<li>Each token can be moved up to once per round (a movement being when you tran... | https://cs.stackexchange.com/questions/45396/move-tokens-from-s-to-t-as-fast-as-possible |
Question: <p>I am reading <a href="http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/3/" rel="nofollow">this</a> article about compiler. I am facing some problem in understanding the content of the token file. Specifically, what is the meaning of the following lines: </p>
<pre><code> [ \t\n] ... | https://cs.stackexchange.com/questions/13909/trying-to-understand-a-token-file-for-lexical-analysis |
Question: <p>My question is about <a href="https://github.com/MIR-MU/CompuBERT" rel="nofollow noreferrer">CompuBERT</a> (<a href="http://ceur-ws.org/Vol-2696/paper_235.pdf" rel="nofollow noreferrer">Three is Better than One Ensembling Math Information Retrieval Systems</a>)</p>
<p>It is written on page 21 (table 2):</p... | https://cs.stackexchange.com/questions/144403/explain-better-how-compubert-handles-math-tokens-on-input |
Question: <p>Suppose I have the following Petri net:</p>
<p><a href="https://i.sstatic.net/4zyXD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4zyXD.png" alt="Petri net" /></a></p>
<p>I wonder whether it is possible to model an inverse relationship between <span class="math-container">$p2$</span> and <... | https://cs.stackexchange.com/questions/144380/how-to-model-an-inverse-token-relationship-in-petri-nets |
Question: <p>so, I am preparing for an exam which includes lexical analysis from compiler design. I was wondering what is the number of tokens in the following code-</p>
<pre><code>int main() {
/* comment
printf("Hello */ There ");*/
return 0;
}
</code></pre>
<p>so, I am thinking upto first "*/" it will be a mu... | https://cs.stackexchange.com/questions/119130/does-a-non-terminated-string-count-as-a-token-in-c |
Question: <p>Let a directed graph $G = (V, E)$ be given, plus a constraint map $c: E \rightarrow V$ and a set $T \subseteq V$ of initial token locations. A valid move consists of sliding a token from $v$ to $w$ if:</p>
<ul>
<li>$v \in T$ — to slide a token, it must be there.</li>
<li>$w \not \in T$ — to move a token ... | https://cs.stackexchange.com/questions/71854/token-sliding-as-a-kind-of-petri-net-well-studied-subclass |
Question: <p>Given a grammar for a space delimited list of words:</p>
<pre><code>S -> word { space word }
word -> [a-zA-Z]+
space -> [ \t]+
</code></pre>
<p>And given the input "Hello World", what token would a <code>peek()</code> operation return?</p>
Answer: | https://cs.stackexchange.com/questions/90908/what-token-does-a-peek-operation-refer-to-in-lexical-analysis |
Question: <p>I'm reading the Dragon Book. The following is from the start of Section 3.1.3.</p>
<blockquote>
<p>When more than one lexeme can match a pattern, the lexical analyzer must provide the subsequent compiler phases additional information about the particular lexeme that matched. For example, the pattern for... | https://cs.stackexchange.com/questions/21560/what-data-is-stored-in-the-symbol-table-for-a-number-token |
Question: <p>Below is the description of the answer to a question which says the following:</p>
<p><strong>Design a data structure to support two operations for a dynamic multiset S of integers which allows duplicate values.</strong></p>
<ol>
<li>Insert operation for one element </li>
<li>Delete-larger-half(S) delete... | https://cs.stackexchange.com/questions/62484/how-does-the-token-method-of-amortized-analysis-work-in-this-example |
Question: <p>This is the problem:</p>
<p>I have some strings stored in the database. Each of the strings can be seen as a set of tokens separated by comma with no repetition (I mean a token cannot appear more than one time in a string).</p>
<p>I want to know if a new string matches any of them without taking token or... | https://cs.stackexchange.com/questions/37174/how-to-do-high-performance-string-matching-when-comparing-unordered-sets-of-toke |
Question: <p>I am facing the following problem in a script I am trying to develop:</p>
<p>Given a string and a set of tokens, where the tokens are known and are overlapping (the set can contain the tokens 'a', 'b' and 'ab'), I need to split the string into a list of tokens from the set. I know there can be multiple one... | https://cs.stackexchange.com/questions/162382/problem-identification-splitting-string-into-tokens-taken-from-a-given-possibl |
Question: <p>In NLP, does the lexer have to tag the tokens before the parser?</p>
<p>I.e. does the lexer have to classify the tokens to morphological categories before the parser?</p>
<p>I'm thinking yes, but is this also the only way to do the parsing?</p>
Answer: <p>Morphological tags can help the parser. On the o... | https://cs.stackexchange.com/questions/51146/in-nlp-does-the-lexer-have-to-tag-the-tokens-before-the-parser |
Question: <p>I study Petri Nets to model some cases related to my job. Currently, I study the basics of Petri Nets and am confused. (For the time being I couldn't get a textbook yet, I will.)</p>
<p><strong>my questions</strong></p>
<p><strong>q1)</strong> What determines the required number of tokens required for th... | https://cs.stackexchange.com/questions/54444/what-determines-the-number-of-arcs-and-tokens-in-a-petri-nets-model |
Question: <p>I was assigned as homework:</p>
<blockquote>
<p>Suppose we have a width-w balancing network of depth $d$ in a quiescent
state $s$ called $B$. Let $n = 2^d$. Prove that if n tokens enter the network
on the same wire, pass through the network, and exit, then $B$ will have
the same state after the to... | https://cs.stackexchange.com/questions/49827/what-does-it-mean-to-have-tokens-at-a-state-in-a-balancing-network |
Question: <p>This was an exam question for my course and I am struggling to actually answer it in a way that is not fluff.</p>
<p>Here is my current answer:</p>
<p><em>CFGs describe how non-terminal symbols are converted into terminal symbols via a parser. However, a scanner defines what those terminal symbols conver... | https://cs.stackexchange.com/questions/55567/why-do-we-not-use-cfgs-to-describe-the-structure-of-lexical-tokens |
Question: <p>Based on <a href="https://www.geeksforgeeks.org/cc-tokens/" rel="nofollow noreferrer">GeeksforGeeks</a> and many other sites, the C/C++ compilers will create the same token for <code>float</code>/<code>int</code> etc.</p>
<p>However if we have something like this:</p>
<pre><code>int A[10.5];
</code></pre... | https://cs.stackexchange.com/questions/89856/why-doesnt-the-c-c-compilers-create-different-tokens-for-different-types-of-n |
Question: <p>I ran the following grammar (pulled from the dragon book) in the Java Cup Eclipse plugin:</p>
<pre><code>S' ::= S
S ::= L = R | R
L ::= * R | id
R ::= L
</code></pre>
<p>The items associated with state 0 given in the Automaton View are as follows:</p>
<pre><code>S ::= ⋅S, EOF
S ::= ⋅L = R, EOF
S ::= ⋅R,... | https://cs.stackexchange.com/questions/59548/why-is-particular-token-missing-in-lalr-lookahead-set |
Question: <p>When modeling a scenario with Petri nets how should I determine the places, transitions and tokens?</p>
<p><strong>Example:</strong> </p>
<p>There are two exam assistants in an exam hall observing the exam. They stand in front of the exam hall. When a student has a question one of the assistants goes to ... | https://cs.stackexchange.com/questions/71814/how-to-determine-places-transitions-and-tokens-in-a-scenario-when-modeling-with |
Question: <p>I am given two files one with the name of person and the location that they are from
(Evan Lloyd|Brownsville)
and one with the name and salary (Evan Lloyd|58697) (the line number that you find the employee on in the first file is not necessarily the line number that find the employee on in the second).
The... | https://cs.stackexchange.com/questions/119887/how-to-tokenize-a-string-and-save-each-substring-separately-independent-names-f |
Question: <p>Foo and Bar are playing a game of strategy. At the start of the game, there are $N$ apples, placed in a row (in straight line). The apples are numbered from $1$ to $N$. Each apple has a particular price value.</p>
<p>The price of $i$th apple is $p_i$.</p>
<p>In this game, the players Foo and bar make an ... | https://cs.stackexchange.com/questions/4899/expected-gain-of-a-game-of-chance-with-differently-priced-tokens |
Question: <p>In NLP, do you distinguish tokens that you don't observe in a training sample and still expect that they may occur in a test sample, between </p>
<ul>
<li>those you know what they are, and</li>
<li>those you don't know what they are, and how many of them</li>
</ul>
<p>If yes, how do you treat them differ... | https://cs.stackexchange.com/questions/22092/in-nlp-tokens-not-seen-in-training-sample-but-you-know-or-dont-know-what-they |
Question: <p>I was going through the text <em>Compilers: Principles, Techniques and Tools</em> by <em>Ullman et. al.</em> where I came across the following excerpt.</p>
<blockquote>
<p>Example 4.11. Consider the abstract language <span class="math-container">$L_1 = \text{ { $wcw$ | $w$ is in $(a|b)^*$}}$</span>. <span ... | https://cs.stackexchange.com/questions/136591/relation-between-programming-languages-requiring-declaration-of-variables-before |
Question: <p>Let's say I have a ring with four nodes $n=\{0;1;2;3\}$ and three possible states $k=\{0;1;2\}$. A transient failure happens and the system ends up in an illegal state.</p>
<p>I know from the restriction ($k \geq n$) that there should be an execution that makes the system stay in its illegal state indefin... | https://cs.stackexchange.com/questions/49738/why-do-we-need-k-geq-n-in-dijkstras-token-ring-self-stabilizing-system |
Question: <p>On a table there are <span class="math-container">$n$</span> stacks (numbered <span class="math-container">$1$</span> to <span class="math-container">$n$</span>). Stack <span class="math-container">$i$</span> contains <span class="math-container">$i$</span> tokens (<span class="math-container">$1 \leq i \l... | https://cs.stackexchange.com/questions/162707/on-a-table-there-are-n-stacks-stack-i-contains-i-tokens-minimum-number-o |
Question: <p>I am trying to define a non terminal symbol in a LALR(1) grammar (with CUP parser). It is requested that </p>
<pre><code>the <code> token must appear exactly twice,
while the <hour> token must appear at least once.
</code></pre>
<p>In the end I came up with this definition:</p>
<pre><code>s... | https://cs.stackexchange.com/questions/9961/how-to-define-at-least-one-occurrence-of-a-string-between-two-tokens-in-bottom-u |
Question: <p>In describing the tokens of a programming language using regular expressions, it is not necessary to have the $\epsilon$, (for the empty set) or t (for the empty string). Why is this?</p>
<p>Please tell me why is it not necessary thanks</p>
Answer: <p>The empty set is only needed in order to describe the... | https://cs.stackexchange.com/questions/85615/in-describing-the-tokens-of-a-programming-language-using-re-it-is-not-necessary |
Question: <p>I wrote a simple stack based language, and am looking to exhaustively generate all programs for it, to find the shortest program that generates a particular output.</p>
<p>Given a program fragment, I can determine if it is terminated, and, if not, how many operands it requires. Currently, my search strat... | https://cs.stackexchange.com/questions/53506/searching-through-all-program-of-a-stack-based-language-with-little-memory |
Question: <p>According to my CS knowledge so far, a lexer uses DFA(which takes linear time) for 'each' token type to find the next token, so in the worst case, it should try 'all possible' token types of a language. (there are some other reasons, e.g. to find the 'longest matching pattern' to distinguish between <code>... | https://cs.stackexchange.com/questions/162979/why-does-lexer-has-on-time-complexity |
Question: <blockquote>
<p>Note: this question was marked as a duplicate in favor of <a href="https://cs.stackexchange.com/questions/23593/is-there-a-system-behind-the-magic-of-algorithm-analysis">this question/answer</a> which attempts to provide a generic formula for translating code to mathematics. </p>
<p>Unf... | https://cs.stackexchange.com/questions/104708/what-time-complexity-big-o-is-this-specific-web-crawler-implementation |
Question: <p>I have some sort of a misunderstanding regarding the Suzuki-Kasami distributed mutex algorithm. I am writing my question here because I failed on gaining access to the original paper.</p>
<p>I will call processes sites for convenience.</p>
<p><strong>My question</strong></p>
<p>Why the token holder $j$ ... | https://cs.stackexchange.com/questions/89680/a-problem-with-suzuki-kasami-mutex-algorithm |
Question: <p>I have a list of tokens <code>T</code>, of length <code>n</code>. Initially I have power <code>p</code> and a <code>score</code> of zero. In one move, I can play <em>any</em> token <code>t</code> either face up or face down.</p>
<p>(a) I can play <code>t</code> face up, provided that I have at least as muc... | https://cs.stackexchange.com/questions/167438/prove-maximum-score-is-achieved-by-being-greedy |
Question: <p>In models like GPT-2, TXL and Grover, is there a good way to know which input weights (tokens) resulted in each token of the output? </p>
Answer: | https://cs.stackexchange.com/questions/115948/is-there-a-way-to-connect-a-deep-language-model-output-to-input |
Question: <p>Say they are two tokens, A and B. A has probability weight 0.99 (and B has 0.01). If I want to encode the sequence "AAA", wouldn't the binary encoding just be "0"? And wouldn't that be the same for encoding "AA", or "AAAA", or an number of A's? How is the decoder sup... | https://cs.stackexchange.com/questions/157561/an-arithmetic-encodings-length-being-ambiguous |
Question: <p>Consider the following game played on a graph <span class="math-container">$G$</span> where each node can hold an arbitrary number of tokens. A move consists of removing two tokens from one node (that has at least two tokens) and adding one token to some neighboring node. The LastToken problem asks whether... | https://cs.stackexchange.com/questions/118196/how-to-prove-lasttoken-problem-is-np-complete |
Question: <p>A link of capacity 100 Mbps is carrying traffic from a number of sources. Each source generates an on-off traffic stream; when the source is on, the rate of traffic is 10 Mbps, and when the source is off, the rate of traffic is zero. The duty cycle, which is the ratio of on-time to off-time, is 1 : 2. When... | https://cs.stackexchange.com/questions/35841/the-maximum-minimum-number-of-sources-that-can-be-multiplexed-so-that-no-data |
Question: <blockquote>
<p><strong>Theorem.</strong> Show that if <span class="math-container">$L$</span> is regular, then so is
<span class="math-container">$$
\varphi(L)=\left\{w \in \Sigma^{*} \mid \text {there exists an } \alpha \in \Sigma^{*} \text { with }|\alpha|=|w| \text { and } \alpha w \in L\right\}
$$</s... | https://cs.stackexchange.com/questions/116780/closure-of-regular-languages-under-inverse-second-half |
Question: <p>Imagine my server is generating "tokens" of some sort for a client on a regular basis. When a client asks for a token, the server responds with a new value (and any other supplemental information it wants to, like a "witness"). Later, the client will submit the token (and optionally the... | https://cs.stackexchange.com/questions/124714/how-to-generate-validate-and-invalidate-a-set-list-of-numbers-in-o1-time-and |
Question: <p>The problem:</p>
<p>You are given a list of strings as an input. You may perform any number of "token substitution" operations. A token substitution is performed by: removing any substring, replacing instances with a new token, and adding that substring to the list. The output of the algorithm is... | https://cs.stackexchange.com/questions/170609/optimal-common-substring-elimination |
Question: <p>Suppose we have a token and our language allows the compiler to build two different derivation trees. However, it can happen that there exists two semantic ways to interpret our token. So ambiguity is not a problem in this case.
Am I correct?</p>
Answer: <p>There are computer languages with ambiguous gram... | https://cs.stackexchange.com/questions/105388/is-ambiguity-in-programming-language-always-bad |
Question: <p>Since Earley parser finds all possible application variants for a token, can it parse text in parallel, unlike the usual parser like stack-based, etc.
You just need to modify the start of each parallel chunk of tokens, then while going backwards while constructing a table you combine and validate the foun... | https://cs.stackexchange.com/questions/110403/can-earley-parser-work-in-parallel |
Question: <p>I was learning what balancing networks are and at some point the art of multicore programming talks about balancers. The text book says:</p>
<blockquote>
<p>A balancer is a simple switch with two input wires and two output
wires, called the top and bottom wires (or sometimes the north and
south wire... | https://cs.stackexchange.com/questions/49829/how-do-balancers-work-in-the-context-of-counting-and-balancing-networks |
Question: <p>I am creating a tool for validating, parsing, and interpreting flowchart diagrams on <a href="https://diagrams.net" rel="nofollow noreferrer">diagrams.net</a>, and it is necessary to give users an opportunity to define a set of rules for the diagram. So, in the end, I want to achieve something like ANTLR f... | https://cs.stackexchange.com/questions/151514/is-there-an-alternative-for-the-formal-language-theory-that-could-be-used-for-fl |
Question: <p>It's possible to parse a document using a single pass from a state machine. What is the benefit of having two passes, ie. having a lexer to convert text to tokens, and having a parser to test production rules on those tokens? Why not have a single pass that applies production rules directly to the text?</p... | https://cs.stackexchange.com/questions/39898/why-separate-lexing-and-parsing |
Question: <p>I have experimented with a grammar that I could turn into a strict left-to-right finite state automaton driven algorithm (bottom up, table driven). The FSA could be complex, that's not a problem. It doesn't need to deal with infinite recursive structures.</p>
<p>I then moved the grammar into BNF, and built... | https://cs.stackexchange.com/questions/159342/parsing-algorithms |
Question: <p>Unsupervised feature discovery of text that started with its bit string representation would need to discover octets were the first-order parse of such a bit string. This raises a question:</p>
<p>What is the technique called that can discover that a binary string, for example:</p>
<p><code>010010011111... | https://cs.stackexchange.com/questions/68693/finding-a-simple-distribution-in-a-binary-string |
Question: <p>if a lexical grammar has multiple token which start with the same character like <code>></code> <code>>></code> <code>>>=</code> and their longest length is 3, does it have 2 character lookahead?</p>
<p>Or is it implementation defined. Does the number of character required to produce a fixed... | https://cs.stackexchange.com/questions/141300/what-defines-how-many-lookahead-a-lexer-has |
Question: <p>Is it better to think about tokens from right to left and perform right factoring on grammar for an LR(1) parser? As apposed to thinking about tokens left to right and doing left factoring on grammar for an LL(1) parser.</p>
<p>Example java import statement.</p>
<pre><code>S1 -> S2 ;
S2 -> S5
S2 ->... | https://cs.stackexchange.com/questions/152048/strategy-to-designing-grammar-for-a-lr1-parser |
Question: <p>There is a problem.</p>
<p>Given string $text$ containing only letters and string $mask$ containing letters and asterisks (*), where asterisk means substitution of zero or more letters, find all substrings of $text$ that fit $mask$.</p>
<p>There is an example: let's $text=cabccbacbacab$, $mask=\textbf{ab... | https://cs.stackexchange.com/questions/91603/find-all-substrings-that-fit-the-mask-with-asterisks |
Question: <p>I have an array a of n entries. I need to place a token on the first and last position of that array, so <code>a[0] = 1</code> and <code>a[n-1] = 1</code>.</p>
<p>I now want to place additional tokens into that array with a distance inbetween each index i where <code>a[i] = 1</code> that is greater than 2 ... | https://cs.stackexchange.com/questions/127994/how-to-find-the-size-of-gaps-between-entries-in-an-array-so-that-the-first-and-l |
Question: <p>I understand the restrictions, because a regular language is expressive enough to allow all types of tokens. And even if some context is needed in many languages to tokenize properly, they all seem to be "approximately" regular languages.</p>
<p>Yet I would be interested if any attempt in any programming ... | https://cs.stackexchange.com/questions/19837/has-there-been-a-lexer-that-takes-in-much-more-than-a-regular-language |
Question: <p>Will the below statement cause any lexical error ?</p>
<pre><code>int a123c ;
</code></pre>
<p>According to me, int would be tokenized as a keyword and there would be a lexical error when "a123c" would be encountered as it doesn't fall into any token category.</p>
<p>I read this question <a href="https:... | https://cs.stackexchange.com/questions/82874/lexical-analysis |
Question: <p>In the <a href="https://class.coursera.org/compilers/lecture/index" rel="nofollow">compiler course by Alex Aiken on Coursera</a>, more specifically lecture <a href="https://class.coursera.org/compilers/lecture/20" rel="nofollow">05-02 Context Free Grammars</a>, the professor says that CFGs give answers of... | https://cs.stackexchange.com/questions/16647/what-information-do-we-get-from-a-compilers-parse-tree |
Question: <p>I'm looking for an algorithm for doing iterated find/replace, where the act of finding the replacement list of tokens for a given find is slow.</p>
<p>Specifically: I have a function, <code>f</code>, that maps a sequence of tokens to either a shorter list of tokens or None. However, it is slow.</p>
<p>I ... | https://cs.stackexchange.com/questions/28307/efficient-algorithm-for-iterated-find-replace |
Question: <p>We are modeling our process using a colored Petri net. One of the limitations we have is that when multiple transitions depend on one place, only one of those transitions will fire because then the token and data is consumed.</p>
<p>How can we model our process, or what type of Petri net property can we u... | https://cs.stackexchange.com/questions/57900/modelling-a-dependency-of-multiple-transitions-on-data-in-one-place |
Question: <p>I'm planning to implement a lexical analyzer by either simulating NFA or running DFA using the input text. The trouble is, the input may arrive in small chunks and the memory may not be enough to hold one very long token in the memory.</p>
<p>Let's assume I have three tokens, "ab", "abcd" and "abce". The ... | https://cs.stackexchange.com/questions/97374/how-to-implement-a-maximal-munch-lexical-analyzer-by-simulating-nfa-or-running-d |
Question: <p>I am studying the <span class="math-container">$k$</span>-gossip problem on dynamic graphs against an adaptive adversary. Essentially, we are given a set of tokens <span class="math-container">$\mathcal{T}$</span> which are distributed amongst the nodes such that each token is distributed to at least one n... | https://cs.stackexchange.com/questions/146390/why-is-onk-an-upper-bound-for-the-k-gossip-problem |
Question: <p>I often work with <a href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a>/<a href="http://en.wikipedia.org/wiki/Parsing">parsers</a>, as opposed to a parser combinator and see people who never took a class in parsing, ask about parsing binary data. Typically the data is not only binary but also c... | https://cs.stackexchange.com/questions/899/why-is-using-a-lexer-parser-on-binary-data-so-wrong |
Question: <p>The book "Introduction to Information Retrieval" <a href="https://nlp.stanford.edu/IR-book/html/htmledition/an-example-information-retrieval-problem-1.html" rel="nofollow noreferrer">talks about term-document incidence matrix</a> for retrieving documents that contain/not-contain certain tokens dr... | https://cs.stackexchange.com/questions/161459/ir-using-document-term-boolean-incidence-matrix-for-answering-a-query |
Question: <p>How were the <a href="https://openai.com/blog/better-language-models/" rel="nofollow noreferrer">GPT-2</a> token embeddings constructed? </p>
<p>The authors mention that they used Byte Pair Encoding to construct their vocabulary. But BPE is a compression algorithm that returns a list of subword tokens tha... | https://cs.stackexchange.com/questions/116184/question-about-word-embeddings-in-a-specific-language-model-gpt-2 |
Question: <p>I have to define a context free grammar for the following rules:</p>
<p>(i) A pair of square bracket tokens [] surrounding zero or more values separated by commas.
(ii) A value can be another array or a number.</p>
<p>A number is represented by the token <code>NUMBER</code>. So for example, <code>[NUMBER... | https://cs.stackexchange.com/questions/55563/context-free-grammar-for-nested-arrays-separated-by-commas |
Question: <p>I was asked how to remove comments in a JavaScript program, but once I gave the regular expression solution, I was asked what if there are comments like text inside of a string:</p>
<pre><code>let hi = " // here ";
let foo = " use this: /* ";
let foo2 = " \" and that */ ";
</code></pre>
<p>it als... | https://cs.stackexchange.com/questions/120126/to-remove-all-comments-in-a-javascript-file-do-we-need-just-a-scanner-or-also-a |
Question: <p>I was trying to understand why the equation $y_i = \left( \frac{n}{w} \right) + (i \pmod w) $ describes the step property in a balancing network?</p>
<p>First, recall $x_i$ to be the number of tokens a network gets as input and similarly $y_i$ to be the number of output tokens. Recall that a balancing net... | https://cs.stackexchange.com/questions/49715/why-is-the-step-property-in-a-balancing-network-defined-as-it-is |
Question: <p>I have written a yacc program for generating palindromic strings consisting of 0s and 1s. Here is the rules section of the yacc program below:</p>
<pre><code>%%
program: expr NL { printf("Valid string.\n"); exit(0); }
;
expr: ZERO expr ZERO
| ONE expr ONE
| ZERO
| ONE
|
;
%%
</code></pre>
<p>He... | https://cs.stackexchange.com/questions/144332/stuck-with-shift-reduce-conflicts-on-yacc-on-grammar-to-generate-palindromic-str |
Question: <p>I was reading "Parsing Techniques: A Practical Guide, Second Edition" by Grune and Jacobs, which details a bunch of different parsing algorithms. In the section on $LR(2)$ parsing, they mention that unlike $LR(1)$ items, which just have an item lookahead (the token that should appear after the completed $L... | https://cs.stackexchange.com/questions/48866/item-lookaheads-versus-dot-lookaheads-for-lrk-with-k-gt-1 |
Question: <p>When I started doing programming I wondered that why the variable names can't start with integer. Back then I accepted that , may be this is how the compiler designers have decided to go with. But now I am studying Compiler Design and they say that lexical analyzer produces token and it is easy / fast if w... | https://cs.stackexchange.com/questions/142101/variable-name-starting-with-integers |
Question: <p>To my knowledge, in block-structured programming languages, there are 2, maybe 3 main ways of delimiting a block.</p>
<ol>
<li>Using start and end tokens, this can be brackets or reserved words etc</li>
<li>Using indentation, like python, which uses the offside rule to delimit blocks</li>
<li>Using prefix ... | https://cs.stackexchange.com/questions/156268/what-are-all-the-ways-of-delimiting-blocks |
Question: <p>I've got a bit of a puzzle here that sits at the intersection of mathematics and technology. Hopefully this doesn't fall into brainteaser territory - I'm not sure a neat solution is possible!</p>
<p>I have two devices. Each one has a short token they would like to share. I am happy for either device to get... | https://cs.stackexchange.com/questions/153170/negotiating-a-connection-between-two-devices-that-cant-transmit-and-receive-sim |
Question: <p>One way to interpret the (simply typed) lambda calculus is via coherence spaces (<a href="http://www.paultaylor.eu/stable/Proofs+Types.html" rel="nofollow">Proofs and Types, chapter 8</a>). For example, we can consider the space containing token element ($\mathbf{1}$) and the space containing two incohere... | https://cs.stackexchange.com/questions/29655/how-do-stable-functions-1-1-relate-to-bool |
Question: <p>I am really confused with this <a href="https://community.topcoder.com/stat?c=problem_statement&pm=13707" rel="nofollow">problem</a>.</p>
<p><strong>Here's the problem:</strong> <br></p>
<p>You have $N$ points numbered $1$ through $N$,inclusive, and $N$ arrows again numbered $1$ through $N$,inclusive... | https://cs.stackexchange.com/questions/59995/understanding-the-mapping-of-edges-to-nodes-in-a-graph-theory-problem |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.