Search Results

Search found 4423 results on 177 pages for 'compiler'.

Page 27/177 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • How to Work Around Limitations in Generic Type Constraints in C#?

    - by Jose
    Okay I'm looking for some input, I'm pretty sure this is not currently supported in .NET 3.5 but here goes. I want to require a generic type passed into my class to have a constructor like this: new(IDictionary<string,object>) so the class would look like this public MyClass<T> where T : new(IDictionary<string,object>) { T CreateObject(IDictionary<string,object> values) { return new T(values); } } But the compiler doesn't support this, it doesn't really know what I'm asking. Some of you might ask, why do you want to do this? Well I'm working on a pet project of an ORM so I get values from the DB and then create the object and load the values. I thought it would be cleaner to allow the object just create itself with the values I give it. As far as I can tell I have two options: 1) Use reflection(which I'm trying to avoid) to grab the PropertyInfo[] array and then use that to load the values. 2) require T to support an interface like so: public interface ILoadValues { void LoadValues(IDictionary values); } and then do this public MyClass<T> where T:new(),ILoadValues { T CreateObject(IDictionary<string,object> values) { T obj = new T(); obj.LoadValues(values); return obj; } } The problem I have with the interface I guess is philosophical, I don't really want to expose a public method for people to load the values. Using the constructor the idea was that if I had an object like this namespace DataSource.Data { public class User { protected internal User(IDictionary<string,object> values) { //Initialize } } } As long as the MyClass<T> was in the same assembly the constructor would be available. I personally think that the Type constraint in my opinion should ask (Do I have access to this constructor? I do, great!) Anyways any input is welcome.

    Read the article

  • Is there a programming language with be semantics close to English ?

    - by ivo s
    Most languages allow to 'tweek' to certain extend parts of the syntax (C++,C#) and/or semantics that you will be using in your code (Katahdin, lua). But I have not heard of a language that can just completely define how your code will look like. So isn't there some language which already exists that has such capabilities to override all syntax & define semantics ? Example of what I want to do is basically from the C# code below: foreach(Fruit fruit in Fruits) { if(fruit is Apple) { fruit.Price = fruit.Price/2; } } I want do be able to to write the above code in my perfect language like this: Check if any fruits are Macintosh apples and discount the price by 50%. The advantages that come to my mind looking from a coder's perspective in this "imaginary" language are: It's very clear what is going on (self descriptive) - it's plain English after all even kid would understand my program Hides all complexities which I have to write in C#. But why should I care to learn that if statements, arithmetic operators etc since there are already implemented The disadvantages that I see for a coder who will maintain this program are: Maybe you would express this program differently from me so you may not get all the information that I've expressed in my sentence Programs can be quite verbose and hard to debug but if possible to even proximate this type of syntax above maybe more people would start programming right? That would be amazing I think. I can go to work and just write an essay to draw a square on a winform like this: Create a form called MyGreetingForm. Draw a square with in the middle of MyGreetingFormwith a side of 100 points. In the middle of the square write "Hello! Click here to continue" in Arial font. In the above code the parser must basically guess that I want to use the unnamed square from the previous sentence, it'd be hard to write such a smart parser I guess, yet it's so simple what I want to do. If the user clicks on square in the middle of MyGreetingForm show MyMainForm. In the above code 'basically' the compiler must: 1)generate an event handler 2) check if there is any square in the middle of the form and if there is - 3) hide the form and show another form It looks very hard to do but it doesn't look impossible IMO to me at least approximate this (I can personally generate a parser to perform the 3 steps above np & it's basically the same that it has to do any way when you add even in c# a.MyEvent=+handler; so I don't see a problem here) so I'm thinking maybe somebody already did something like this ? Or is there some practical burden of complexity to create such a 'essay style' programming language which I can't see ? I mean what's the worse that can happen if the parser is not that good? - your program will crash so you have to re-word it:)

    Read the article

  • Is it possible to implement bitwise operators using integer arithmetic?

    - by Statement
    Hello World! I am facing a rather peculiar problem. I am working on a compiler for an architecture that doesn't support bitwise operations. However, it handles signed 16 bit integer arithmetics and I was wondering if it would be possible to implement bitwise operations using only: Addition (c = a + b) Subtraction (c = a - b) Division (c = a / b) Multiplication (c = a * b) Modulus (c = a % b) Minimum (c = min(a, b)) Maximum (c = max(a, b)) Comparisons (c = (a < b), c = (a == b), c = (a <= b), et.c.) Jumps (goto, for, et.c.) The bitwise operations I want to be able to support are: Or (c = a | b) And (c = a & b) Xor (c = a ^ b) Left Shift (c = a << b) Right Shift (c = a b) (All integers are signed so this is a problem) Signed Shift (c = a b) One's Complement (a = ~b) (Already found a solution, see below) Normally the problem is the other way around; how to achieve arithmetic optimizations using bitwise hacks. However not in this case. Writable memory is very scarce on this architecture, hence the need for bitwise operations. The bitwise functions themselves should not use a lot of temporary variables. However, constant read-only data & instruction memory is abundant. A side note here also is that jumps and branches are not expensive and all data is readily cached. Jumps cost half the cycles as arithmetic (including load/store) instructions do. On other words, all of the above supported functions cost twice the cycles of a single jump. Some thoughts that might help: I figured out that you can do one's complement (negate bits) with the following code: // Bitwise one's complement b = ~a; // Arithmetic one's complement b = -1 - a; I also remember the old shift hack when dividing with a power of two so the bitwise shift can be expressed as: // Bitwise left shift b = a << 4; // Arithmetic left shift b = a * 16; // 2^4 = 16 // Signed right shift b = a >>> 4; // Arithmetic right shift b = a / 16; For the rest of the bitwise operations I am slightly clueless. I wish the architects of this architecture would have supplied bit-operations. I would also like to know if there is a fast/easy way of computing the power of two (for shift operations) without using a memory data table. A naive solution would be to jump into a field of multiplications: b = 1; switch (a) { case 15: b = b * 2; case 14: b = b * 2; // ... exploting fallthrough (instruction memory is magnitudes larger) case 2: b = b * 2; case 1: b = b * 2; } Or a Set & Jump approach: switch (a) { case 15: b = 32768; break; case 14: b = 16384; break; // ... exploiting the fact that a jump is faster than one additional mul // at the cost of doubling the instruction memory footprint. case 2: b = 4; break; case 1: b = 2; break; }

    Read the article

  • Trying to write a std::iterator : Compilation error

    - by Naveen
    I am trying to write an std::iterator for the CArray<Type,ArgType> MFC class. This is what I have done till now: template <class Type, class ArgType> class CArrayIterator : public std::iterator<std::random_access_iterator_tag, ArgType> { public: CArrayIterator(CArray<Type,ArgType>& array_in, int index_in = 0) : m_pArray(&array_in), m_index(index_in) { } void operator++() { ++m_index; } void operator++(int) { ++m_index; } void operator--() { --m_index; } void operator--(int) { --m_index; } void operator+=(int n) { m_index += n; } void operator-=(int n) { m_index -= n; } typename ArgType operator*() const{ return m_pArray->GetAt(m_index); } typename ArgType operator->() const { return m_pArray->GetAt(m_index); } bool operator==(const CArrayIterator& other) const { return m_pArray == other.m_pArray && m_index == other.m_index; } bool operator!=(const CArrayIterator& other) const { return ! (operator==(other)); } private: CArray<Type,ArgType>* m_pArray; int m_index; }; I also provided two helper functions to create the iterators like this: template<class Type, class ArgType> CArrayIterator<Type,ArgType> make_begin(CArray<Type,ArgType>& array_in) { return CArrayIterator<Type,ArgType>(array_in, 0); } template<class Type, class ArgType> CArrayIterator<Type,ArgType> make_end(CArray<Type,ArgType>& array_in) { return CArrayIterator<Type,ArgType>(array_in, array_in.GetSize()); } To test the code, I wrote a simple class A and tried to use it like this: class A { public: A(int n): m_i(n) { } int get() const { return m_i; } private: int m_i; }; struct Test { void operator()(A* p) { std::cout<<p->get()<<"\n"; } }; int main(int argc, char **argv) { CArray<A*, A*> b; b.Add(new A(10)); b.Add(new A(20)); std::for_each(make_begin(b), make_end(b), Test()); return 0; } But when I compile this code, I get the following error: Error 4 error C2784: 'bool std::operator <(const std::_Tree<_Traits &,const std::_Tree<_Traits &)' : could not deduce template argument for 'const std::_Tree<_Traits &' from 'CArrayIterator' C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xutility 1564 Vs8Console Can anybody throw some light on what I am doing wrong and how it can be corrected? I am using VC9 compiler if it matters.

    Read the article

  • Is the output of Eclipse's incremental java compiler used in production? Or is it simply to support Eclipse's features?

    - by Doug T.
    I'm new to Java and Eclipse. One of my most recent discoveries was how Eclipse comes shipped with its own java compiler (ejc) for doing incremental builds. Eclipse seems to by default output incrementally built class files to the projRoot/bin folder. I've noticed too that many projects come with ant files to build the project that uses the java compiler built into the system for doing the production builds. Coming from a Windows/Visual Studio world where Visual Studio is invoking the compiler for both production and debugging, I'm used to the IDE having a more intimate relationship with the command-line compiler. I'm used to the project being the make file. So my mental model is a little off. Is whats produced by Eclipse ever used in production? Or is it typically only used to support Eclipse's features (ie its intellisense/incremental building/etc)? Is it typical that for the final "release" build of a project, that ant, maven, or another tool is used to do the full build from the command line? Mostly I'm looking for the general convention in the Eclipse/Java community. I realize that there may be some outliers out there who DO use ecj in production, but is this generally frowned upon? Or is this normal/accepted practice?

    Read the article

  • Why does java have an interpreter? and not a compiler?

    - by Galaxin
    Iam a newbie to java and was wondering why java have a interpreter and not a compiler? While shifting from c++ to java we come across the differences between these two Compilation process being one of them. 1.A major difference between a compiler and interpreter is that compiler compiles the whole code at once and displays all the errors at a time whereas an interpreter interprets line by line. 2.Also a compiler takes a less time to compile a code when compared to an interpreter. When java was developed for more advanced and easy features and implementations why has it been restricted to a interpreter based on above facts? Is there any special reason why this is so? If yes what is it?

    Read the article

  • how to return NULL for double function with Intel C compiler?

    - by Derek
    I have some code that I am porting from an SGI system using the MIPS compiler. It has functions that are declared to have double return type. If the function can't find the right double, those functions return "NULL" The intel C compiler does not like this, but I was trying to see if there is a compiler option to enable this "feature" so that I can compile without changing code. I checked the man page, and can't seem to find it. Thanks

    Read the article

  • Why isn't there a python compiler to native machine code?

    - by user2986898
    As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?

    Read the article

  • How can I create an Online compiler/Interpreter editor or is there any third party app that can be integrated? [on hold]

    - by atjoshi
    I am looking out for some solution where I can start developing an Online compiler/Interpreter editor. For Eg: http://code.hackerearth.com/5c4db5N Are there any third Party Pulgin Available or any way to do from scratch I am a PHP Dev. ? Looking for some possible hints how I can start with. Any link to good blog or tutorial. May be its not right place to ask this question but at least I can get best solutions here from experienced professionals. Thanks in advance

    Read the article

  • Why is not there a python compiler to native machine's code?

    - by user2986898
    As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?

    Read the article

  • Microsoft ajoute un nouveau service de Build à la version hébergée de Team Foundation Server permettant de compiler sur Windows Azure

    Microsoft ajoute nouveau service de Build à la version hébergée de Team Foundation Server permettant de compiler le code source sur Windows Azure Microsoft a procédé à une mise à jour de la version hébergée de Team Foundation Server sur Windows Azure. Team Foundation Server est une solution de travail collaboratif permettant la gestion des sources, des builds, le suivi des éléments de travail, la planification et l'analyse des performances. Il y a un an de cela, Microsoft avait porté la solution sur sa plateforme d'hébergement Cloud Windows Azure. La société vient d'annoncer qu'un nouveau service de Build a été ajouté à Team Foundation. Ce service réduit le...

    Read the article

  • Programming Java 7 in Eclipse

    - by reprogrammer
    I installed JDK 7 and Eclipse 3.6M6. Then, I added JRE 7 as a new JRE execution environment in Eclipse, and set the compiler compliance level to Java 7. I can compile the following piece of code through command line using the javac that comes with JDK 7. import java.util.HashMap; import java.util.Map; public class Try { public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); } } But, Eclipse gives the following error messages. Incorrect number of arguments for type HashMap; it cannot be parameterized with arguments Try.java /TryJava7/src line 7 Java Problem Syntax error on token "<", ? expected after this token Try.java /TryJava7/src line 7 Java Problem Even though I've set the compliance level of the compiler to Java 7, it looks like Eclipse doesn't understand Java7 syntax yet. Is it possible to play with Java 7 in Eclipse? The following is the content of .classpath. <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="output" path="bin"/> </classpath> And, the following is the content of .settings/org.eclipse.jdt.core.prefs. eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7

    Read the article

  • are custom classes imported API included in .class files?

    - by kyrogue
    i have a question, i have a custom class which imports java.sql.; and i am creating a jsp page, in the jsp page, i did a page import of the custom class , however when i tried to call my custom class database methods it cant work. only when i did a page import of java.sql. did it work. so are custom classes imported API included in .class files? An error occurred at line: 6 in the jsp file: /resetpw.jsp Statement cannot be resolved to a type 3: 4: <% 5: db.connect(); 6: Statement stmt = db.getConnection().createStatement(); 7: ResultSet rs = stmt.executeQuery("SELECT * FROM created_accounts"); 8: 9: An error occurred at line: 7 in the jsp file: /resetpw.jsp ResultSet cannot be resolved to a type 4: <% 5: db.connect(); 6: Statement stmt = db.getConnection().createStatement(); 7: ResultSet rs = stmt.executeQuery("SELECT * FROM created_accounts"); 8: 9: 10: Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451) org.apache.jasper.compiler.Compiler.compile(Compiler.java:319) org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.31 logs. edited. added what error will come up if i did not do a page import of java.sql.*;

    Read the article

  • xcode linker error on iPhone app (Only on simulator)

    - by RexOnRoids
    Im getting this linker error that won't let me compile. It only happens on the simulator. KEY POINTS: - Happens only in simulator - Similar to THIS question, but found no FRAMEWORK_SEARCH_PATHS in my .pbxproj file - Though my OS is 10.6.2, I had to build target 1.5 to avoid other linker errors - libxml2.dylib IS required and is in my Frameworks group - The other cited libraries I have never heard of. - Tried bringing in those other Libs under frameworks, didn't solve. Build SpaceTweet of project SpaceTweet with configuration Debug Ld build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet normal i386 cd "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)" setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -L/Users/Scott/Desktop "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/../../libYAJLIPhone-0" -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib "-F/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -filelist "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/SpaceTweet.build/Debug-iphonesimulator/SpaceTweet.build/Objects-normal/i386/SpaceTweet.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework MessageUI -lYAJLIPhone -lxml2 -o "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet" ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.dylib, missing required architecture i386 in file ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 CLUE: Again, MY question is very similar to THIS SOLVED QUESTION except that in my case I did NOT find a FRAMEWORK_SEARCH_PATHS entry in the .pbxproj file in my project bundle and thus could not solve in the manner in which that question was solved.

    Read the article

  • Compiling Asterisk 1.6.2 on MacOSX Server

    - by Jeremy Quinn
    I get this error while trying to compile Asterisk 1.6.2 on Snow Leopard Server : ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/dylib1.o/bundle1.o) Googling this I’ve found nothing enlightening so far. This is what I am trying: ./configure --without-h323 --without-zaptel --host=x86_64-darwin make menuselect make

    Read the article

  • fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64'

    - by KK
    Hi, I am using VS 2003 .Net on 32 bit XP OS. I have also installed "Microsoft Platform SDK" on my machine. Can I build vc++ application (binaries) targeted for 64 bit OS? I am using following project options : Name="VCLinkerTool" AdditionalOptions="/machine:AMD64 bufferoverflowU.lib" OutputFile="\bin\Release\MM64.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="&quot;C:\Program Files\Microsoft Platform SDK\Lib\AMD64&quot;" GenerateDebugInformation="TRUE" ProgramDatabaseFile="\bin\Release\MM64.pdb" GenerateMapFile="TRUE" MapFileName="\bin\Release\MM64.map" MapExports="TRUE" MapLines="TRUE" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary=".\Release/MM64.lib" TargetMachine="0"/> I am getting following error: fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64' Do I need to build project on 64 bit OS or I need to change project settings to resolve this error. Please help me to resolve this issue.

    Read the article

  • aspnet_compiler fails when using App_Browsers folder with Web Deployment Project

    - by steeno
    Hi When Compiling my Web Deployment Project which references a Asp.Net project with a App_Browsers folder I get the following compilation error: C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v /[PROJECTNAME].csproj -p "[FILEPATH]" -u -f -d .\TempBuildDir\ ASPNETCOMPILER : error ASPRUNTIME: Object reference not set to an instance of an object. If I remove the App_Browsers folder everything works perfectly. Any help would be appreciated.

    Read the article

  • how to resolve this .Net 3.5 warning/error?

    - by 5YrsLaterDBA
    I have three machines. one installed VS2008 another two installed SDK6 and Framework3.5 (one of these two is a build machine). When I use MSBuild to build our application, all of them get this warning: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. and the build machine comes with some errors: scsm\SCSM.cs(234,13): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(235,13): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(304,13): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(314,13): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(317,13): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(323,17): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(324,17): error CS1501: No overload for method 'Invoke' takes '1' arguments scsm\SCSM.cs(325,17): error CS1501: No overload for method 'Invoke' takes '1' arguments but other machines are passed without error. Resources are identical in those three machines. searched online but cannot find answer. Anybody here can help me resolve this? thanks

    Read the article

  • Removing Left Recursion in ANTLR

    - by prosseek
    As is explained in http://stackoverflow.com/questions/2652060/removing-left-recursion , there are two ways to remove the left recursion. Modify the original grammar to remove the left recursion using some procedure Write the grammar originally not to have the left recursion What people normally use for removing (not having) the left recursion with ANTLR? I've used flex/bison for parser, but I need to use ANTLR. The only thing I'm concerned about using ANTLR (or LL parser in genearal) is left recursion removal. In practical sense, how serious of removing left recursion in ANTLR? Is this a showstopper in using ANTLR? Or, nobody cares about it in ANTLR community? I like the idea of AST generation of ANTLR. In terms of getting AST quick and easy way, which method (out of the 2 removing left recursion methods) is preferable?

    Read the article

  • iPhone app linker error on Snow Leopard (Only on simulator)

    - by RexOnRoids
    Im getting this linker error that won't let me compile. It only happens on the simulator. NOTE: - OSX 10.6.2 but had to use 10.5 as build target to avoid other linker errors - libxml2.dylib IS required and is in my Frameworks group - The other cited libraries I have never heard of. - Tried bringing in those other Libs under frameworks, didn't solve. Build SpaceTweet of project SpaceTweet with configuration Debug Ld build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet normal i386 cd "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)" setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -L/Users/Scott/Desktop "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/../../libYAJLIPhone-0" -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib "-F/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -filelist "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/SpaceTweet.build/Debug-iphonesimulator/SpaceTweet.build/Objects-normal/i386/SpaceTweet.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework MessageUI -lYAJLIPhone -lxml2 -o "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet" ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.dylib, missing required architecture i386 in file ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

    Read the article

  • What does this mean: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’

    - by Brendan Long
    I have a member function in a class that has a callback, but the callback isn't strictly neccessary, so it has a default callback, which is empty. It seems to work fine, but I get an annoying warning: warning: converting from ‘void (ClassName::*)()’ to ‘void (*)()’ I'm trying to figure out what it means and how to turn it off (or fix it if I really am doing something wrong). Here's some simple code: class ClassName{ public: void doSomething(void (*callbackFunction)() = (void(*)()) &ClassName::doNothing){ callbackFunction(); } void doNothing(){} }; int main(){ ClassName x; x.doSomething(); return 0; } Note: If I do this (without explicitly casting it as a void(*)()): void doSomething(void (*callbackFunction)() = &ClassName::doNothing) I get this: main.cpp:3: error: default argument for parameter of type ‘void (*)()’ has type ‘void (ClassName::*)()’

    Read the article

  • Delphi - E2010 Incompatible types: 'Integer' and 'Char' - Any ideas

    - by zeencat
    I've been tasked with porting a legacy Delphi application over to C# .Net. The original delphi developer left several months before I was hired. I'm receiving the E2010 Incompatible types: 'Integer' and 'Char' error for the below method. I'm trying to compile the application within the Delphi 2007 IDE, I've been told that original application is either Delphi 4 or 5 if that helps any. I understand what the error is telling me but I don't understand why\how it is applied to the code snippet below. Any help\direction would be greatly appreciated. Thanks in advance function StrIComp_JOH_PAS_1(const Str1, Str2: PChar): Integer; var Ch1, Ch2 : Char; Offset : Integer; PStr : PChar; begin; PStr := Str1; Offset := Str2 - PStr; repeat Ch1 := Upper[PStr^]; Ch2 := Upper[PStr[Offset]]; if (Ch1 = #0) or (Ch1 <> Ch2) then Break; Inc(PStr); until False; Result := Integer(Ch1) - Integer(Ch2); end;

    Read the article

  • Determining the maximum stack depth

    - by Joa Ebert
    Imagine I have a stack-based toy language that comes with the operations Push, Pop, Jump and If. I have a program and its input is the toy language. For instance I get the sequence Push 1 Push 1 Pop Pop In that case the maximum stack would be 2. A more complicated example would use branches. Push 1 Push true If .success Pop Jump .continue .success: Push 1 Push 1 Pop Pop Pop .continue: In this case the maximum stack would be 3. However it is not possible to get the maximum stack by walking top to bottom as shown in this case since it would result in a stack-underflow error actually. CFGs to the rescue you can build a graph and walk every possible path of the basic blocks you have. However since the number of paths can grow quickly for n vertices you get (n-1)! possible paths. My current approach is to simplify the graph as much as possible and to have less possible paths. This works but I would consider it ugly. Is there a better (read: faster) way to attack this problem? I am fine if the algorithm produces a stack depth that is not optimal. If the correct stack size is m then my only constraint is that the result n is n = m. Is there maybe a greedy algorithm available that would produce a good result here?

    Read the article

  • Xcode 4 and cocos2D 1.0.0 beta Uncategorized errors and Info.plist doesn't exist

    - by badben
    I just installed the xcode 4 sdk and the cocos2d 1.0.0 beta template. I just created a new project with the cocos2d template. But when I build I got these errors : (for information my previous projects developed with xcode 3 have the same problem) warning: couldn't add 'com.apple.XcodeGenerated' tag to '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build': Error Domain=NSPOSIXErrorDomain Code=2 UserInfo=0x201dde680 "The operation couldn’t be completed. No such file or directory" error: unable to create '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates' (Permission denied) error: unable to create '/Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products' (Permission denied) Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build/Objects-normal/i386 Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/PrecompiledHeaders/Prefix-dflnzjtztxdgjwhistrvvjxetfrg Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/PrecompiledHeaders/Prefix-fqemzerugrwojibbegzkffljkxqs Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Intermediates/xcode4.build/Debug-iphonesimulator/xcode4.build Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Index/PrecompiledHeaders/Prefix-dbtcglhksokwygezixirqkgfipsr_ast Unable to create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Index/PrecompiledHeaders/Prefix-gdirtpasdqzasnclnkzguimarjpd_ast error: couldn't create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products/Debug-iphonesimulator/xcode4.app: Permission denied error: couldn't create directory /Users/Benoit/Library/Developer/Xcode/DerivedData/xcode4-bswxazfuwbsguiasyatbtlmvbpps/Build/Products/Debug-iphonesimulator/xcode4.app: Permission denied The file “Info.plist” doesn’t exist. Please help !!

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >