compiler

using graphviz with qt

hi , i have a compiler project and i want to print the ast after the compile complete so can i print this ast to qt (on c++) panel using graphviz ? note : i dont know if there is a binding between qt or c++ and graphviz , so if it doesnt work please help me to find the alternative . thanks . ...

Does VS2010 use csc.exe / vbc.exe (directly or indirectly) to compile relevant projects?

Pretty much as the title suggests. I can't find any proof that DevEnv.exe actually calls these at any point. ...

Elegent way to collapse or expand sub-sequences of a list in Python?

I want to collapse or expand sub-sequences of a list e.g. ['A', 'B', 'D', 'E', 'H'] -> ['AB', 'DE', 'H'] and vice versa EDIT: the example above may cause misunderstanding. the following is better: e.g. ['foo', 'bar', 'wtf'] <-> ['baz', 'wtf'] currently I wrote some ugly code like: while True: for i, x in enumerate(s): if x ==...

What is the difference between LR, SLR, and LALR parsers?

What is the actual difference between LR, SLR, and LALR parsers? I know that SLR and LALR are types of LR parsers, but what is the actual difference as far as their parsing tables are concerned? And how to show whether a grammar is LR, SLR, or LALR? For an LL grammar we just have to show that any cell of the parsing table should not con...

How do CUDA devices handle immediate operands?

Compiling CUDA code with immediate (integer) operands, are they held in the instruction stream, or are they placed into memory? Specifically I'm thinking about 24 or 32 bit unsigned integer operands. I haven't been able to find information about this in any of the CUDA documentation I've examined so far. So references to any documents o...

Asymptotic complexity of a compiler

What is the maximal acceptable asymptotic runtime of a general-purpose compiler? For clarification: The complexity of compilation process itself, not of the compiled program. Depending on the program size, for instance, the number of source code characters, statements, variables, procedures, basic blocks, intermediate language instructi...

Ambiguity in LL grammar

Considering the following grammar S -> iEtES'|a S'-> eS S'-> E-> b What will the value of FOLLOW(S'). I know that if there is a production fo the form `A->aB' then everything in FOLLOW(A) is in FOLLOW(B) but corresponsind to the above grammar FOLLOW(S') is same as FOLLOW(S) then what is FOLLOW(S)? Whether this rule will be applied fo...

g++ no matching function call error

I've got a compiler error but I can't figure out why. the .hpp: #ifndef _CGERADE_HPP #define _CGERADE_HPP #include "CVektor.hpp" #include <string> class CGerade { protected: CVektor o, rv; public: CGerade(CVektor n_o, CVektor n_rv); CVektor getPoint(float t); string toString(); }; the .cpp: #include "CGerade.hp...

looser throw specifier for in C++

I am getting an error that says: error: looser throw specifier for 'virtual CPLAT::CP_Window::~CP_Window()' On the destructor, I have never heard of this before and some Google Searches say this might be a GCC 4 problem, which I would not be sure how to work around since I need GCC 4 to build a Universal Binary. My Environment: OS X 1...

Class Declaration in C++

What does it mean when a class is declared like this: class CP_EXPORT CP_Window : public CP_Window_Imp What is the CP_EXPORT portion? What does it mean/imply? ...

Can you exclude code automatically when using the publish feature in Visual Studio

Is their a way to exclude a block of code when you use the publish feature in visual studio. In other words say I had a log in button that did something like: // Start Exclude when publishing if (txtUserName.Text == "" && txtPassword.Password == "") { lp = new System.ServiceModel.DomainServices.Client.ApplicationServices...

Beginner C++ Question

I have followed the code example here toupper c++ example And implemented it in my own code as follows void CharString::MakeUpper() { char* str[strlen(m_pString)]; int i=0; str[strlen(m_pString)]=m_pString; char* c; while (str[i]) { c=str[i]; putchar (toupper(c)); i++; } } But this gives me the following compiler...

variable scope in statement blocks

for (int i = 0; i < 10; i++) { Foo(); } int i = 10; // error, 'i' already exists ---------------------------------------- for (int i = 0; i < 10; i++) { Foo(); } i = 10; // error, 'i' doesn't exist By my understanding of scope, the first example should be fine. The fact neither of them are allowed seems even more odd. Sur...

What is everything involved from typing in code to executing a program?

I realized, when just asking a question, I don't understand all the components that are part of the coding process. This seems a silly question, but I can't find a definitive answer on Google, Wiki, nothing. What exactly are all the parts called, and how do they work and intertwine? I'm talking whatever you type code into, whatever che...

What kind of .lib file begins with "!<arch>" ?

Hi all, I have a .lib file, just wondering what compiler it's from: it begins with "!<arch>" ? Thanks ...

How does the compiler choose which method to call when a parameter type is ambiguous?

I have the following code: [TestMethod] public void TestFoo() { Foo(null); } private void Foo (object bar) { Console.WriteLine("Foo - object"); } private void Foo (string bar) { Console.WriteLine("Foo - string"); } and when I run the test "TestFoo()", the console output...

How to deal with alias registers in data-flow analysis using SSA form? (e.g. EAX/AX/AH/AL in x86)

For exmaple: How to represent the following x86 in SSA form: xor eax, eax inc ax By introducing some pseudo functions, I come up with: eax@1 = eax@0 ^ eax@0 ax@1 = LOWORD(eax@1) al@1 = LOBYTE(ax@1) ah@1 = HIBYTE(ax@1) hax@1 = HIWORD(eax@1) ax@2 = ax@1 + 1 eax@2 = MAKEDWORD(ax@2, HIWORD(eax@1)) al@2 = LOBYTE(ax@2) ah@2 = HIBYTE(a...

Anonymous union definition/declaration in a macro GNU vs VS2008

I am attempting to alter an IAR specific header file for a lpc2138 so it can compile with Visual Studio 2008 (to enable compatible unit testing). My problem involves converting register definitions to be hardware independent (not at a memory address) The "IAR-safe macro" is: #define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)...

why optimization does not happen?

hi. I have C/C++ code, that looks like this: static int function(double *I) { int n = 0; // more instructions, loops, for (int i; ...; ++i) n += fabs(I[i] > tolerance); return n; } function(I); // return value is not used. compiler inlines function, however it does not optimize out n manipulations. I would ex...

Main Function Error C++

I have this main function: #ifndef MAIN_CPP #define MAIN_CPP #include "dsets.h" using namespace std; int main(){ DisjointSets s; s.uptree.addelements(4); for(int i=0; i<s.uptree.size(); i++) cout <<uptree.at(i) << endl; return 0; } #endif And the following class: class DisjointSets { public: void addelements(int x); in...