Programming :: Parser Symbols With Different Types
Nov 27, 2010
I decided to try making a programming language again after my last unsuccessful attempt, so now I figured how to write a good AST and it works great when the nodes are hard-coded into a test program. But to make a language out of it, I need a parser to build the tree according to an input file. I ran into a problem here:
YACC input file:
Code:
%{
#include "nodes/allnodes.h"
#include "Node.h"
int vars[26];
%}
%token SEMICOLON INTEGER VARIABLE IF WHILE DO OPAREN CPAREN OBRACE CBRACE
%right ASSIGN
%left NE
%left PLUS MINUS
%left TIMES DIVIDE
%% .....
As you might see, each nonterminal creates a Node* object and uses it as its value. The problem is that the literal tokens, however, don't return Node*'s and I don't know what to do. I would like to be able to convert literal tokens to nodes in the Lex file (which would avoid the problem), but the problem is with the assignment operator, which takes a Node* for the right-hand side and a variable name (not a Variable Node, because they just evaluate the the variable's value and you can't change the variable with them) for the left hand side.
View 14 Replies
ADVERTISEMENT
Apr 5, 2010
By issuing the 'nm' command on shared library (internally using one static library), the functions exposed by static library is also being listed, Which allows to use internal functions which is of course not intended. I have one static library having A(), B() and C() functions. Creating one shared library which has function XYS() that is using A() and B() functions from Static library. While doing 'nm' on shared library, all the static library function are being listed.
Static Lib:
#include<stdio.h>
void A(char *msg)
{
printf("
[code]....
View 4 Replies
View Related
Sep 12, 2010
I'm trying to use "netlink" to get ip address of a Linux box. But the linux/types.h included from "linux/rtnetlink.h" introduced many conflicting type declarations with "sys/types.h".
#include <rtnetlink.h>
#include <sys/types.h>
#include <sys/socket.h>
int main (int argc, char *argv[])
{
return 0;
}
The program will demonstrate such type conflicts.
View 3 Replies
View Related
Jul 7, 2011
I'll show the code first:
Code:
What I am after is to get the string text from the clip tags. But for now I just tested to see if it can finds the command tags and print something if it does. But it doesn't find it. Anyone knows why ?
Looks like the xml is not good, i test it with a xml validator:
Code:
View 1 Replies
View Related
Jan 14, 2011
I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:./mybin arg1 arg2 ...then during program execution there's an interactive prompt asking for more parameters:
...
>> (second bunch of arguments here)
...
I'd like to run my program inside a bash script, but I don't know how to give the second level arguments.
View 2 Replies
View Related
Nov 12, 2009
I'm woring on a personal research project and would like to know if there are lilypond parsers for python available or I'll have to create my own. Just in case you are wondering: I don't need to typeset the content of the lilypond file, just understand what's written in the file (what notes, what duration, when in time to play each one, etc). [url]
View 1 Replies
View Related
Jan 13, 2011
iḿ trying to parse a file using html parser by libxml.
Code: #include <stdio.h>
#include <libxml/HTMLparser.h>
#include <string.h>
void main(){
printf("main
");
[Code]....
View 4 Replies
View Related
May 12, 2011
Probably a stupid sounding question, but bear with me please. I need to use the link grammar parser in order to do some part of speech tagging. It's freely available and works once you run the makefile or 'make' it or however it's correctly said. Thing is, it has a C API which I intend to use. And once I ran a bit of the sample code given in the documentation it gave a whole host of errors. This is very confusing because I'm including the path for the folder that has all the header files.
gcc -I/path/include/ filename.c. But it still gives me errors about not being able to find things that are clearly defined there. An hour of trudging around the internet tells me I need to 'compile' the API first. I'm not exactly sure how or if I'm supposed to do that. If someone could just shed light on this it would be greatly appreciated. I grow increasingly cynical to the musical swell of my tiny brain rattling in my skull.
View 5 Replies
View Related
Mar 23, 2011
I'm trying to develop an html template parser employing Flex & Bison, but now I found a problem and I don't know if surrender, so let's see if you can guide me to the solution (if any).
[Code]...
(Here I simplified the code to make only print what it gets, but it returns a token and the text to the bison program). Now my problem is that I would like to get the unknown characters as an unique string. [using the flex file above, returns char by char all HTML code that is not a comment!].
So, Could it be possible to make a flex rule that gets the HTML code?. It is not necessary to check if HTML code is correct I do it (before parse) using expat. Also there is no need to check the resulted code it will be done by the parser or compiler of the used language.
I know that are a lot of tools that uses this kind of templates in all languages and systems... but I'm just exercising my pour flex&bison skills. Also, using my current flex file, I have to remove the string "<!--MARKUP" from the beginning and "-->" from the end of returned string to bison... But in reality, if I could manage the HTML code as a flex rule, I could solve that sednding to bison an start Token, the code and and end token.
View 1 Replies
View Related
Apr 9, 2011
I would like port 80 to have a small daemon running on it that detects HTTP traffic and sends a small redirect response, and any other traffic begins streaming data from my VPN daemon. I was wondering if this has already been made, or any kind of technology for detecting types of traffic and allowing you to run multiple types of servers on the same port.
View 4 Replies
View Related
Oct 19, 2010
I'm running gdb across a network using gdb server. I've got it up and running. However I can't see any source or variables for my code (in ddd /gdb). At start up gdb says (no debugging symbols found). I've got a g in my make file,
CPFLAGS = -Wall -Os -g -pedantic
I've tried loading symbols in using "symbol-file testarm", this sort of works in that I can view symbols but not names, e.g. if I ask dd to show x y and z, rather than
x = 10
y = 20
x = 30
It says:
display
10/20/30
Also ddd does not show anything in the source window, is there a way I can get it to show this? I think it's because I've started ddd with ddd arm-linux-gdb, as I'm calling a crosscompiler gdb. So can I tell ddd to point to the correct folders? What commands I need to set in gdb/ddd to view variable names (it's hard to keep track when it bunches them all together) and how to view my source code.
View 2 Replies
View Related
Aug 22, 2010
I was going through some exercise given in my school. I have read the C book but I am not able to understand some part. That is static variable. What exactly is a static variable and what does it do? I saw in Linux Kernel Programming external and exported are also some thing. I am not getting the difference between static,EXPORT_SYMBOL,external variable types. If I make a kernel module then how will I make sure that my variable is visible to the kernel. Is this what it is all talking about? I have checked this page [URL].
View 2 Replies
View Related
Jul 15, 2010
What are the different types of API's in linux?How can we predict the kind of API we are using?And what are API layers related to?Are API's and system calls ,both are same?
View 5 Replies
View Related
Apr 2, 2010
I am trying to port c & c++ open source code onto embedded target(MIPS).It compiles fine on x86/RH4. When I try embedded platform specific tool chain as follows, I get following error:
I tried different combinations. It did not help. My idea is to port an open source code that works fine on X86/Linux to an embedded target based on MIPS.
View 4 Replies
View Related
Aug 21, 2010
Arm-linux-strip for removing the symbols from binary executable file after compilation. What exactly the symbols means.
View 1 Replies
View Related
May 4, 2010
I have a shared library (built from C++ code) and a separate C program which calls (extern) functions from the said library.
Also one of the functions in that library needs to call a function in this C program by declaring it 'extern'. This sort of creates a cyclic dependency.
I am getting "unresolved references" error, as expected.
View 3 Replies
View Related
Jan 6, 2011
I wasn't sure where to put this so if I need to move it just let me know.I have a strange problem that I cannot figure out. When I use gdb to debug our rpm-installed program, it says (no debugging symbols found) when it loads. Thing is, when I use nm on the program it can print the symbols, and even stranger is if I use gdb on the program before it is packed up by rpmbuild it loads the debug symbols just fine.Our program is built via the standard make using:GS=-g -Wall-pedantic and as I mentioned I can debug the resulting program. After the build, I package it up using:
cmd="rpmbuild -v -bb ptsnmp.spec --define "ver ${cmvc_release}" --define "rel ${cmvc_level}" --define "_topdir $rpmdir""When this package is installed via rpm, the binary on the machine shows all the debug info via nm, file shows it is not stripped:pt_snmp: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not strippedyet when I try to debug it I get the no debugging symbols found.This is really taxing my brain and I am sure I am just missing something
View 4 Replies
View Related
Feb 17, 2010
I am using Centos 5.4 with gcc v4.1.2. If I take a bunch of .o files and I then link with my main.o to form an executable then this links and executes just fine. If however, I try to create an archive file (.a) using 'ar rus xxx.o yyy.o etc' and then try to link the resulting .a with my main.o then I get 'undefined symbol' linker errors and I don't understand why.
View 2 Replies
View Related
Jan 20, 2011
The first is about implementing function calls. The way I currently have it is that functions are called with a C++ std::vector of nodes as the parameters. How would I turn a comma-seperated list of expressions into a C++ vector in the grammar?Second, how do you implement left-associative operators in a parser that does not allow left recursion?
And third, what would be the best internal representation of integers? A C++ int seems simplest, but limited. Using GMP seems more versatile, but I'm afraid it might seriously slow down the interpreter compared to C++ ints.
View 3 Replies
View Related
Jun 24, 2010
I guess I'm just a noob, but I notice that some C libraries (and even some C++ ones) tend to redefine the basic types with their own naming convention.
For example, OpenGL redefines the basic types:
Code: from GL/gl.h
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef signed char GLbyte;
typedef short GLshort;
typedef int GLint;
[Code].....
View 3 Replies
View Related
Jun 9, 2011
i am searching for a table that gives info about the result of operations (+ , - , * , /) on data types
i mean if we * int by another int, the result should be assign in long so no overflow happens.
something like that.
like what will be the result of mult unsigned int by signed it , is there tables for such operations.
View 6 Replies
View Related
Feb 1, 2010
I have functions which return different data like: int, char*, double...
I also have a list of datatypes (INTEGER, TEXT, REAL...) which can be returned.
I need to map a datatype with function, which purpose is to return it. Therefore, when I determine a datatype, I would like to call the required function without doing switch all the time.
My idea is to have an array of structs like this:
Code:
struct type_func_map
{
int type;
void (*func_wrapper_int)(void); //void (*func_wrapper_text)(void); void (*func_wrapper_real)(void);
};
[Code].....
View 10 Replies
View Related
Feb 24, 2011
#define TRIP 6
#include <stdio.h>
char error_area(char area_code, char S, char M, char L,char N,char P, char K, char R, char
[code].....
View 2 Replies
View Related
Oct 12, 2010
The first line of this struct:
Code:
struct custom_int {
typedef int big_int;
[code]...
View 4 Replies
View Related
Mar 24, 2009
can anyone provide me with the path where i can find the library files. stdio.h, sys/types.h.......
View 4 Replies
View Related
Sep 1, 2011
I'm using Grsync and I want to be able to plug in any drive into my laptop and run rsync on it to back up all the user documents on there to another external hdd and to exclude everything else. Working on the principle that user documents don't always appear where we'd expect I want rsync to look through the whole drive and filter what it backs up by file type. I am only having partial success, however.
I am using the 'filter' option in the 'additional options' box. I am using the command
Code:
filter='merge /home/tim/Desktop/filter'
and I am attaching the filter file I have written. (I have added the .txt extention to upload it).
I have tested this script on my home folder and here's what's going wrong. Rsync will copy the entire directory structure regardless of whether there are any files to be copied over in those directories. I am also getting only some file types getting included and not others. .odt and .ods files are copied, for instance, but not .doc or .rtf.
View 3 Replies
View Related
Jul 16, 2010
I need to have a global variable PHP Code: volatile sig_atomic_t int Terminazione=0; but I get the error error: two or more data types in declaration specifier even if I have included signal.h.
View 2 Replies
View Related
Mar 1, 2010
Only ones I can think of seem overly complex, and I'm sure there is a simple solution I am overlooking. I have a class, it has a member who is an object. This object needs to be able to represent an object of different types.
[code]...
Where "surface" could be several different types, which will be set during execution. Hope this is clear enough. I have tried using templates but am getting "data member cannot be a member template". Either I have incorrect syntax, or am not implementing it right. another solution would have one class containing definitions of all possible shapes, But this would take up extra memory. Other solutions I thought of seem too round-about, and seems there is a simpler solution that I have overlooked.
View 8 Replies
View Related
Nov 26, 2010
I have just changed something in preferences for Skins. Then I restarted my vlc media player and now I cant run vlc! I removed and reinstalled vlc Thousand times but it didn't work! When I type vlc in Terminal :
exc3llent@exc3llent:~$ vlc
VLC media player 1.1.5 The Luggage (revision exported)
Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS")
Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE")
Blocked: call to setlocale(6, "")
Blocked: call to sigaction(17, 0xb752a0d4, 0xb752a04
Warning: call to signal(13, 0x1)
Warning: call to signal(13, 0x1)
Warning: call to srand(1289860942)
Warning: call to rand()
Blocked: call to setlocale(6, "")
(process:13965): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Warning: call to signal(13, 0x1)
Warning: call to signal(13, 0x1)
[0x86ee1b4] vcdx access error: fread (): Is a directory
[0x85a4aac] xml xml error: XML parser error (line 2) : Validation failed: no DTD found !
[0x858db84] skins2 interface error: no skins found : exiting
Blocked: call to sigaction(17, 0xbfbfb4d8, 0xbfbfb44c)
Blocked: call to sigaction(17, 0xbfbfb44c, (nil))
View 2 Replies
View Related
Apr 1, 2010
I have tried looking for expat xml parser version 2.0.1 rpm package for centos or RHEL but have not been able to find one. I did find one based for fedora (x86), can this be installed on centos without any issues? Also, I have found a tar package (expat-2.0.1.tar.gz), is the correct directory to decompress and install this under the /usr/local/bin?
View 1 Replies
View Related