Search Results

Search found 5015 results on 201 pages for 'compiler construction'.

Page 4/201 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to write a Compiler in C for C

    - by Kerb_z
    I want to write a Compiler for C. This is a Project for my College i am doing as per my University. I am an intermediate programmer in C, with understanding of Data Structures. Now i know a Compiler has the following parts: 1. Lexer 2. Parser 3. Intermediate Code Generator 4. Optimizer 5. Code Generator I want to begin with the Lexer part and move on to Parser. I am consulting the following book: Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. The thing is that this book is highly theoretical and perplexing to me. I really appreciate the authors. But the point is i am not able to begin my project, as if i am blinded where to go. Need guidance please help.

    Read the article

  • Open source C compiler in C#?

    - by Dinah
    I've been getting into compiler creation. I've found some terrific beginner stuff and advanced stuff but nothing in the middle. I've created 3 different simple proof-of-concept compilers for toy languages but I want to expose myself to something real. The most straight forward real language in terms of syntax seems to be C. Since the language I'm most comfortable with right now is C#, I'd love to study the source code of a real non-tutorial C compiler written in C#. Does one (with source code available) exist?

    Read the article

  • C2360 compiler error on TFS build, but not on desktop

    - by pdmaguire
    A c++ code snippet similar to the code below caused our TFS build to fail with a C2360 compiler error. switch (i) { case 0 : for each (int n in a) System::Console::WriteLine(n.ToString()); break; case 1 : System::Console::WriteLine("n is not in scope here"); break; } This is fixed by using {} brackets within the body of case 0, as below: switch (i) { case 0 : { for each (int n in a) System::Console::WriteLine(n.ToString()); } break; case 1 : System::Console::WriteLine("n is not in scope here"); break; } The developer had successfully compiled the code on their desktop before committing the changes. A cursory look at versions of things like compilers, Visual Studio etc on the server and desktop suggest they are the same. The source code is the same, obviously. What is the difference between a desktop build and TFS build that would smother a compiler error like this?

    Read the article

  • Deciphering a queer compiler warning about unsigned decimal constant

    - by Artagnon
    This large application has a memory pool library which uses a treap internally to store nodes of memory. The treap is implemented using cpp macros, and the complete file trp.h can be found here. I get the following compiler warning when I attempt to compile the application: warning: this decimal constant is unsigned only in ISO C90 By deleting portions of the macro code and using trial-and-error, I finally found the culprit: #define trp_prio_get(a_type, a_field, a_node) \ (2654435761*(uint32_t)(uintptr_t)(a_node)) I'm not sure what that strange number is doing there, but I assume it's there for a good reason, so I just want to leave it alone. I do want to fix the warning though- any idea why the compiler's saying that it's unsigned only in ISO C90? EDIT: I'm using gcc-4.1

    Read the article

  • Require Integer Value not Memory Address whilst avoiding Invalid receiver type compiler warning

    - by Dave Anderson
    I have the following code; int days = [[SettingsUtils daysToRetainHistory] intValue]; [retainHistory setText:[NSString stringWithFormat:@"Days to retain History: %d", days]]; [daysToRetainHistory setValue:days animated:NO]; where [SettingsUtils daysToRetainHistory] is as follows; + (int) daysToRetainHistory { return (int)[[NSUserDefaults standardUserDefaults] objectForKey:@"CaseBaseDaysToRetainHistory"]; } I get the compiler warning Invalid receiver type 'int' because I call intValue on an int but unless I do this I can't seem to get the integer value out and always end up with the memory address i.e. 98765432 instead of 9 which ruins the UILabel display [retainHistory] and the UISlider [daysToRetainHistory] value. How do I avoid the compiler warning and still get my integer value in the label and the necessary float value for setting the UISlider value?

    Read the article

  • Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

    - by Victor Liu
    I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed certain optimizations. I was trying to look at the assembly listing generated with g++ (g++ -c -g -O2 -Wa,-ahl=file.s file.c) to possibly see what is going on under the hood, but the output is too cryptic to me. What techniques do people use to tackle this problem, and are there any good references on how to interpret the assembly listings of optimized code or articles specific to the GCC toolchain that talk about this problem?

    Read the article

  • Can C/C++ compiler report struct member offset

    - by Chen Jun
    Hello, everyone. I'd like to ask, can compiler(e.g. Visual C++) generate a report(.txt) telling struct member offset for a struct/all structs? If so, it helps debugging quite a lot. For example, when you read disassembler code in the debugger, it can be easier to associate an offset value to a struct member. Also, it is better to have compiler report offset of each local variable on a function stack frame(e.g. the offset relative to ebp on an X86 machine). Thank you in advance.

    Read the article

  • Compiler reordering around mutex boundaries?

    - by shojtsy
    Suppose I have my own non-inline functions LockMutex and UnlockMutex, which are using some proper mutex - such as boost - inside. How will the compiler know not to reorder other operations with regard to calls to the LockMutex and UnlockMutex? It can not possibly know how will I implement these functions in some other compilation unit. void SomeClass::store(int i) { LockMutex(_m); _field = i; // could the compiler move this around? UnlockMutex(_m); } ps: One is supposed to use instances of classes for holding locks to guarantee unlocking. I have left this out to simplify the example.

    Read the article

  • Construction Paper, Legos, and Architectural Modeling

    I can remember as a kid playing with construction paper and Legos to explore my imagination. Through my exploration I was able to build airplanes, footballs, guns, and more, out of paper. Additionally I could create entire cities, robots, or anything else I could image out of Legos.  These toys, I now realize were in fact tools that gave me an opportunity to explore my ideas in the physical world through the use of modeling.  My imagination was allowed to run wild as I, unknowingly at the time, made design decisions that directly affected the models I was building from the raw materials.  To prove my point further, I can remember building a paper airplane that seemed to go nowhere when I tried to throw it. So I decided to attach a paper clip to the plane before I decided to throw it the next time to test my concept that by adding more weight to the plane that it would fly better and for longer distances. The paper airplane allowed me to model my design decision through the use of creating an artifact in that I created a paper airplane that was carrying extra weight through the incorporation of the paper clip in to the design. Also, I remember using Legos to build all sorts of creations, and these creations became artifacts of my imagination. As I further and further defined my Lego creations through the process of playing I was able to create elaborate artifacts of my imagination. These artifacts represented design decision I had made in the evolution of my creation through my child like design process. In some form or fashion the artifacts I created as a kid are very similar to the artifacts that I create when I model a software architectural concept or a software design in that the process of making decisions is directly translated in to a tangible model in the form of an architectural model. Architectural models have been defined as artifacts that depict design decisions of a system’s architecture.  The act of creating architectural models is the act of architectural modeling. Furthermore, architectural modeling is the process of creating a physical model based architectural concepts and documenting these design decisions. In the process of creating models, the standard notation used is Architectural modeling notation. This notation is the primary method of capturing the essence of design decisions regarding architecture.  Modeling notations can vary based on the need and intent of a project; typically they range from natural language to a diagram based notation. Currently, Unified Markup Language (UML) is the industry standard in terms of architectural modeling notation  because allows for architectures to be defined through a series of boxes, lines, arrows and other basic symbols that encapsulate design designs in to virtual components, connectors, configurations and interfaces.  Furthermore UML allows for additional break down of models through the use of natural language as to explain each section of the model in plain English. One of the major factors in architectural modeling is to define what is to be modeled. As a basic rule of thumb, I tend to model architecture based on the complexity of systems or sub sub-systems of architecture. Another key factor is the level of detail that is actually needed for a model. For example if I am modeling a system for a CEO to view then the low level details will be omitted. In comparison, if I was modeling a system for another engineer to actually implement I would include as much detailed information as I could to help the engineer implement my design.

    Read the article

  • How to see the code generated by the compiler

    - by atch
    Guys in one of excersises (ch.5,e.8) from TC++PL Bjarne asks to do following: '"Run some tests to see if your compiler really generates equivalent code for iteration using pointers and iteration using indexing. If different degrees of optimization can be requested, see if and how that affects the quality of the generated code"' Any idea how to eat it and with what? Thanks in advice.

    Read the article

  • IAR MSP430 compiler internal error while compiling

    - by michael
    IAR C/C++ Compiler for MSP430 5.10.1 [Evaluation] (5.10.1.20144) I get an illegal state internal error when attempting to compile the FreeRTOS 5.4 Task.c file (everything else compiles fine) Internal Error: [CoreUtil/General]: Illegal state The kick start version of IAR (MSP430 version) works fine. Any thoughts?

    Read the article

  • Get compiler generated delegate for an event

    - by Sandor Davidhazi
    I need to know what handlers are subsribed to the CollectionChanged event of the ObservableCollection class. The only solution I found would be to use Delegate.GetInvocationList() on the delegate of the event. The problem is, I can't get Reflection to find the compiler generated delegate. AFAIK the delegate has the same name as the event. I used the following piece of code: PropertyInfo notifyCollectionChangedDelegate = collection.GetType().GetProperty("CollectionChanged", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);

    Read the article

  • STM32 Compiler/Debugger Chain?

    - by Nate
    I'm starting a project with a STMicro STM32. I've done the Google searches, looking for solid compiler/debugger chains but would prefer answers with success stories. Open Source Compilers/Linkers would be ideal, I just don't know if their STM32 toolchains are stable yet. (Both C, C++ compilers are acceptable). -- So commercial options are acceptable as well. Do any of you have useful suggestions?

    Read the article

  • Learning to write a compiler

    - by Anton
    Preferred Languages : C/C++, Java, and Ruby I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby so I prefer resources that involve one of those three, but any good resource is acceptable.

    Read the article

  • How to manually throw a compiler error in GCC and Xcode

    - by coneybeare
    In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won't accidentally do something stupid. I did some googling, but could not figure out how to cause the compiler to bail if a certain condition is met. Surely it must be easy, am I just not finding it?

    Read the article

  • C precision of double: compiler dependent?

    - by yCalleecharan
    Hi,on my 32-bit machine (with an Intel T7700 duo core), I have 15 precision digits for both double and long double types for the C language. I compared the parameters LDBL_DIG for long doubles and DBL_DIG for doubles and they are both 15. I got these answers using MVS2008. I was wondering if these results can be compiler dependent or do they just depend on my processor? Thanks a lot...

    Read the article

  • Unique_ptr compiler errors

    - by Godric Seer
    I am designing and entity-component system for a project, and C++ memory management is giving me a few issues. I just want to make sure my design is legitimate. So to start I have an Entity class which stores a vector of Components: class Entity { private: std::vector<std::unique_ptr<Component> > components; public: Entity() { }; void AddComponent(Component* component) { this -> components.push_back(std::unique_ptr<Component>(component)); } ~Entity(); }; Which if I am not mistaken means that when the destructor is called (even the default, compiler created one), the destructor for the Entity, will call ~components, which will call ~std::unique_ptr for each element in the vector, and lead to the destruction of each Component, which is what I want. The component class has virtual methods, but the important part is its constructor: Component::Component(Entity parent) { parent.addComponent(this) // I am not sure if this would work like I expect // Other things here } As long as passing this to the method works, this also does what I want. My confusion is in the factory. What I want to do is something along the lines of: std::shared_ptr<Entity> createEntity() { std::shared_ptr<Entity> entityPtr(new Entity()); new Component(*parent); // Initialize more, and other types of Components return entityPtr; } Now, I believe that this setup will leave the ownership of the Component in the hands of its Parent Entity, which is what I want. First a small question, do I need to pass the entity into the Component constructor by reference or pointer or something? If I understand C++, it would pass by value, which means it gets copied, and the copied entity would die at the end of the constructor. The second, and main question is that code based on this sample will not compile. The complete error is too large to print here, however I think I know somewhat of what is going on. The compiler's error says I can't delete an incomplete type. My Component class has a purely virtual destructor with an implementation: inline Component::~Component() { }; at the end of the header. However since the whole point is that Component is actually an interface. I know from here that a complete type is required for unique_ptr destruction. The question is, how do I work around this? For reference I am using gcc 4.4.6.

    Read the article

  • Is ToString() optimized by compiler?

    - by TheVillageIdiot
    Suppose I've following Code: Console.WriteLine("Value1: " + SomeEnum.Value1.ToString() + "\r\nValue2: " + SomeOtherEnum.Value2.ToString()); Will Compiler Optimize this to: Console.WriteLine("Value1: " + SomeEnum.Value1 + "\r\nValue2: " + SomeOtherEnum.Value2); I've checked it with IL Disassembler and there are calls to IL_005a: callvirt instance string [mscorlib]System.Object::ToString() I don't know if JIT optimizes this.

    Read the article

  • C compiler for iPhone?

    - by thyrgle
    If you want to see why I am asking this look at my other question: http://stackoverflow.com/questions/2894615/how-to-display-console-text-in-uitextview So basically, I need to know if there is an iPhone C compiler that can be installed on the iPhone... Then I need to know what parameter I would put in the system("compile Foo") function. Thanks for the help in advanced.

    Read the article

  • CSharp Compiler and Windows.Forms

    - by j-t-s
    Hi All I've just created a little app that programmatically compiles code using the C# Compiler, and it works brilliantly. But, one thing that I need it to do is compile Windows.Forms code. Like, I can create a console app with it, but I can't create a GUI-based form. Here's the link that got me started: http://support.microsoft.com/kb/304655 Can somebody please help? Thank you :)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >