Automata | An editor for deterministic finite automata
kandi X-RAY | Automata Summary
kandi X-RAY | Automata Summary
Automata is an editor for deterministic and non-deterministic finite automata (DFA, NFA, NFAε). It is an open source web application aimed to help students and educators better understand and explain the concepts of computation in theoretical computer science university departments.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Automata
Automata Key Features
Automata Examples and Code Snippets
Community Discussions
Trending Discussions on Automata
QUESTION
Here is the project.
It should show an interactive grid on screen, with some buttons and an explanation on how to best interact with the system, but I suppose I have done something wrong. It works on my local environment.
JS:
...ANSWER
Answered 2021-Apr-24 at 12:24So here is the solution, what was necessary was adding the correct Pen Settings.
QUESTION
I'm studying automata and I have this problem related to PDAs
construct a PDA for the language L = { w = x1y1x2y2….xnyn | where w belongs to {0,1}*, and the string y1y2….yn is the same as x1x2….xn except the 1’s in y come after the 0’s} For example the string 100111 belongs to L since x=101 and y=011. So do the strings 0011, 00, 1111, 100001, etc. However, the strings 0110, 11111001, 1100, 01, 10 do not belong to L. For simplicity, in the construction of the PDA assume the input consists of pairs of symbols in which the first belongs to x and the second to y. Thus the input alphabet is Σ = {00, 01, 10, 11}.
I realize I have to push/pop from the stack in a way that guarantees that the same input in x appears in y where 0's come before 1's a but the problem is how to check that the 0's in y come before the 1's . a hint for the solution is really appreciated
...ANSWER
Answered 2021-May-28 at 10:25Hint 1: Since the string is the in the form xyxyxy...
, you will always encounter a 1
in the x part before a 1
in the y part, even if the x and y parts are the same.
Hint 2: You're matching 1
s in the x part to the 1
s in the y part. Push for 1
s in x, pop for 1
s in y.
Hint 3: Once you pop, you can't stop. (I.e., hint #2 is not enough on its own, consider a string like 100100
.)
QUESTION
I am trying to understand this paper, Tree template matching in ranked ordered trees by pushdown automata. The first step is having the tree in postfix notation.
How do I take a tree such as this:
...ANSWER
Answered 2021-May-18 at 06:24It doesn't make a lot of sense. However, you can either use parentheses:
QUESTION
I have a function that lets you create an instance of an automata by a given index. The user chooses an option from a menu and the index of the row chosen determines the automata to use.
...ANSWER
Answered 2021-May-12 at 17:27One easy way is to store callables in your dictionary rather than instantiated objects:
QUESTION
hi i have a basic a check box list in my html which is controlled by a script that limits the checks to 4 boxes only . now i need to take only the checked boxes that the user has chosen , i cant seem to get a good idea to take it
...ANSWER
Answered 2021-May-10 at 19:42It looks like you need a different way of getting those checkboxes. Here's one way using Element.querySelectorAll().
QUESTION
I've been messing around with cellular-automata for a while now, and the way I chose to implement them is by creating a 2D vector of cells, where each cell was initially a vector of integers itself (because I want each cell to store more than one value), which I later changed to short unsigned integers, and then to chars, because I realized the smallest data type is more than enough for my needs...
I'm currently looking for ways to improve performance, and it got me thinking, would it be better optimization-wise if I replaced the vector of chars with a string?
Knowing that the entire matrix always has a fixed size, meaning the size of the 2D grid as well as that of each cell is allocated from the beginning and is unchanging for the duration of the program's runtime:
Which one is faster to access? Modify? Copy? Or preform general operations on?
Also, I know I said everything has a fixed size, but just for future reference, according to my surface-level knowledge of vectors, a vector has to be re-allocated everytime you push_back() a new element into it, is that the case with strings?
...ANSWER
Answered 2021-May-03 at 16:07which one is faster?
Depends. Either one, depending on how you use them. You can find out whether one is measurably faster than the other by... measuring.
They both use fundamentally the same abstract data structure, and have the same asymptotical complexity for all operations.
according to my surface-level knowledge of vectors, a vector has to be re-allocated everytime you push_back()
Your knowledge is incorrect. A std::vector
has to only be reallocated when the capacity of the vector is exceeded, which isn't everytime you push_back. Same appilies to std::string
QUESTION
There is a set of rules, where each rule corresponds to ceratain cellular automaton. I need to check property of bijectivity for each of these rules. As there are too much of them (2^32 to be precise), I decided to use my GPU for this purpose. But after week or so I am still struggling with one bug.
Briefly speaking, when the kernel is enqueued and its execution is supposedly being performed on GPU, the usage of GPU is as if it is idle. Furthermore, after I added several statements to kernel code in order to see if kernel is being executed at all, I found no signs of that the statements and therefore kernel itself were executed. Besides, all error codes are equal to CL_SUCCESS. I might get something wrong as I'm new to OpenCL programming and will apreciate any help.
This is the host side code with some abbreviations:
ANSWER
Answered 2021-Apr-25 at 15:21You have a race condition: You read bijective_rules[0];
, but other threads at the same time might execute bijective_rules[0]++;
, thereby reading and writing to that memory location. If two threads write different data to the same memory address, you have a race condition and it is random which of the two gets to decide the result. So your result will be random and non-reproducible.
If multiple threads need to increment a value in the same memory location, use the atoimic function atomic_inc
. Atomic functions block the memory location while one thread is working on it, and all other threads have to wait.
To get rid of the race condition, read from one copy of the buffer (or one particular memory address) and write to a second copy (or address). This way, you never write to the memory that other concurrent threads are reading from.
QUESTION
I've been getting into Automata theory, compilers and the fundamentals of CS, but there is something fundamental that I don't understand.
I have seen the Chomsky Hierarchy of languages where different classes of languages that have different expressive power are "associated" with an equivalently powerful automaton.
From Wikipedia :
GRAMMAR LANGUAGE AUTOMATON
- Type-0 Recursively enumerable Turing machine
- Type-1 Context-sensitive Linear-bounded non-deterministic Turing machine-
- Type-2 Context-free Non-deterministic pushdown automaton
- Type-3 Regular Finite state automaton
I've seen that every programming language are Turing Complete and that the grammar specifications of programming languages (formalised in BNF, etc..) can be expressed as a Context-free Grammar.
Context-free grammars dont have an "associated" Turing Machine as equivalent.
During interpretation / compilation, the string of the source code of a program written in a programming language (like C, python, etc..) is parsed/translated into an Abstract Syntax Tree.
(As I understand, this is like extracting an array from a string when matching the string against a regular expression, except that the pattern here is not a regular expression, it is a context-free grammar, which is more powerful, hence the tree structure extracted which contain more information that a linear array (coming from capture groups of a regex).)
So the program written, potentially implementing a Turing Machine, is converted into an Abstract Syntax Tree, and all the information contained into the original program is now incorporated into the tree. And later, during execution, the program will accompished some computation that can be as complex as a Turing Machine.
My question is : How can a string expressed within the confines of the rules dictated by what a Context-free Grammar can be, be implementing a Turing Machine while the equivalence grammar/language/automata and the Chomsky Hierarchy say a Context-free Grammar isn't expressive enough to do so ?
Is one of my assumptions wrong ? Or is the fact that memory plays a role in this, and that there is a theorem that says something like : a Turing Machine can be implemented "using" a Tree + a Stack ?
This is really bugging me.
Anything that can enlighten me is really appreciated !
EDIT :
Here's a DUPLICATE of my question :
chomsky hierarchy and programming languages
Why I mistakenly thought that the syntax specification of a programming language defines its semantics ?
Because of what YACC does : (syntax-directed translation)
https://en.wikipedia.org/wiki/Syntax-directed_translation
which associates the rules of the context-free grammar used to parse the programming language (which is used to make the abstract syntax tree) with an action. This is the source of my confusion.
For example, here's a copy paste of an extract of the source code of the perl5 interpreter. This is the file perly.y which is used to by yacc to make the first pass of compilation.
...ANSWER
Answered 2021-Apr-22 at 00:39The 'level' of grammar you use to define a language determines the automaton required to recognize (parse) that language, but it is unrelated to the "power" of that language.
E.g., if you use a Type 2 grammar (CFG) to define a language, the Chomsky hierarchy tells you that you'll need a pushdown automaton to recognize it, but the language might be a Turing-complete programming language, or it might be a language for regular expressions, or it might be a language with no computational "power" at all.
For a more extreme example, you can imagine using a Type 3 grammar (regular expression) to define a language for 'programming' a Turing machine.
The power of a language (in particular, whether it's Turing-complete) depends on its semantics, not its syntax.
QUESTION
So currently I am building a small game and I am using Cellular Automata to generate the world.
So my problem comes here. I am tryig to find a way on how to read and assign neighbours of Tiles.
Like a Tile will be created and its 4 neighbours (Above,To the right,To the left and under it) will be assigned to it and it can access these Tiles through code. (Needed for world generation)
I don't want to use Rayscast or Spheres to detect neighbours as it slows down performance and gets quickly messy
I have been trying to find a way for weeks, but I don't understand how should I approach this problem
Here is my code for the world Generation.
...ANSWER
Answered 2021-Apr-08 at 07:26First of all you would rather need to store not only int
values but rather your tiles so I would store the value along with the tiles.
QUESTION
There is something I don't fully get about the LR(0)
. I'm trying to figure out when grammar is not LR(0)
. As I understand I build the LR(0)
items automata. Then I need to look for conflict. But I don't think that I fully understand when there is a conflict between two items in the LR(0)
items automata.
Is it possible to clear things up about this part? When do I know is there a conflict in the LR(0)
items automata? Would be helpful to see an example or two (not for the grammar itself, rather for two items that have a conflict off some kind).
For example for:
...ANSWER
Answered 2021-Feb-18 at 23:26There is not a "conflict between 4 and 8". (That wouldn't make sense, since the parsing machine is always in exactly one state.) Each of the two states (independently) has a conflict.
LR(0) parsers cannot use lookahead to predict the action, so every state must either have:
- A shift transition for every input, or
- The same reduction action for every input
That means that if there is a single item in the state's itemset with the • at the end (i.e. a reducible item), then it must be the only item in the itemset. Any other item would either be a shift or a different reduction. And that's not the case for states 4 and 8 in your machine; both of them have the item C ::= •
, along with other items not ending with •
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Automata
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page