New answers tagged

2

Any Compiler, Interpreter, Assembler performs the task to encode the programming language into strings of binary instructions that the host system's processor could understand. No matter what high-level programming language you use, the programs needs to be converted into binary strings specific to the instruction-set of the processor. So on basis of my ...


6

A programming language is a formal language. Most likely its context-free, sometimes context-sensitive, rarely just regular (mostly eso-langs, and some assembly languages). There usually exists a formal grammar somewhere that defines the syntax of the language. Sometimes, this grammar isn't even written down explicitly and only exists inside the reference ...


7

You download the language's tools. If the language can be compiled to a "native" executable, (e.g., like "Rust") then you download the compiler, and probably a run-time support library, and maybe a linker, a debugger, etc. If the language requires an interpreter (e.g., like Ruby) or a "virtual runtime environment" (e.g., like Java) then you download those ...


13

A programming language is a formal language, informally speaking a collection of words with a well-formed set of specific rules. As such, you can write down the definition of a formal language and thus a programming language on a piece of paper. Also, if I've written down somehow digitally the definition of a programming language, surely you can represent ...


0

Your original grammar is not only left-recursive, it is also ambiguous. Left-recursion only matters to certain parsing techniques, but ambiguous grammars are, by definition, impossible to parse with a deterministic parser. And removing left-recursion does not in general fix ambiguity. The ambiguity is in the production R → R + R which allows 1 + 2 + 3 to ...


0

Your factoring is wrong. It should be (written as regular espressions): $\begin{align*} R &\to (L \mid \operatorname{num}) (+ R)^* \end{align*}$ Thus the grammar with left recursion fixed is: $\begin{align*} S &\to L = R \\ L &\to * L \mid \operatorname{id} \\ R &\to L R' \mid \operatorname{num} R' \\ R' &\to + R ...


0

This is the FOLLOW function: $follow(S) = \{\$,+,-,b,],c\}$ $follow(X) = \{],c\}$ $follow(Y) = \{b,],c\}$


0

Yes, your solution and process are correct, assuming that alpha and beta are variables. It might help to rewrite your terms in a more uniform way, e.g. T1 = *(list(int), list(alpha)) T2 = *(alpha, beta) Here, a term always satisfies the grammar: Term ::= Constant | Variable | Func "(" Term+ ")" Furthermore, it might clarify things to think ...


Top 50 recent answers are included