Questions tagged [symbol-table]

A `symbol table` is a data structure that maps each identifier in a program's source code to information relating to its declaration or appearance in the source.

A symbol table is used by a language translator (compiler, interpreter...) for associating each identifier in a program's source code with information relating to its declaration or appearance in the source (type, scope level, sometimes location...).

A common implementation technique is to use a hash table implementation. A compiler may use one large symbol table for all symbols or use separated, hierarchical symbol tables for different scopes.

202 questions
0
votes
0 answers

Ruby interpreter magically assigns unreferenced variables?

$ irb irb(main):001:0> foo NameError: undefined local variable or method `foo' for main:Object from (irb):1 from /Users/justinwiley/.rbenv/versions/2.1.2/bin/irb:11:in `
' So far so good, 'foo' is undefined. irb(main):002:0> if…
Allyl Isocyanate
  • 13,306
  • 17
  • 79
  • 130
0
votes
1 answer

Compiler scanner - "position" in the symbol table meaning

I read in a Compiler Design course that the output of scanning is a sequence of pairs (token code, token position in the symbol table). I am a bit confused about the meaning of the "position" part. When the symbol table is represented as a structure…
0
votes
1 answer

Antlr 3.2. Symbol table from grammar (Small C)

I need to finish my small-c to p-code compiler in a couple of weeks but am really having trouble understanding how to make my symbol table and subsequent code generation phase. Where can I start, I've seen a couple examples but I'm not getting the…
0
votes
1 answer

Compiler changing function names

I have this weird situation going on. I am trying to de-prefix some of the raspberry pi c library functions. For example I want bcm2835_delay() to be delay(). I have two files, pi.h and pi.c. When I compile the two with gcc -lm pi.c -c my…
0
votes
1 answer

How to get a current symbol table

In python we can use the following: symtable.symtable(code,file,compile type) But is it possible to get a symtable object a current executable code?
St.Antario
  • 26,175
  • 41
  • 130
  • 318
0
votes
1 answer

Symbol table implementation

I want to design an assembler for IBM360 language.so here im implementing the symbol table of pass1. But m getting the 1 error during compilation. I'm not able to deal with that error.can anyone guide me??? my program is here... import java.io.*;…
chinu
  • 133
  • 4
  • 6
  • 12
0
votes
1 answer

flex and bison conflicting types for ‘yylval’

While compiling lex program an error obtained : conflicting types for ‘yylval’ extern YYSTYPE *yylval; Any idea how to correct this one? This the the lex code %{ #include #include"y.tab.h" extern char *yylval; %} %% …
0
votes
1 answer

Expression Parser with Stacks and Symbol Tables

First off, I'll be forthright in stating that this is a homework question. I have to build an expression parser using the following code as my basis: Edit: public class Interpreter { public static Double parser(ST variables,…
rice2007
  • 115
  • 12
0
votes
1 answer

How to get global variables definition from symbols tables?

I am doing development with Visual Studio 2005 or 2010 in C/C++ language. I want to get a global structure definition information from symbol tables in a binary or execute file. Take a example in the following. A global structure named 'TD' and…
0
votes
3 answers

Saving large data in vector c++

I am having a huge data in a file that i need to read and do some probabilities on it, so i need to count the number of occurances of each word in the whole file and do some more calculations on it. the files contains 1 million and half records and…
Michael Girgis
  • 145
  • 4
  • 14
0
votes
1 answer

get_symbol function in C

Im building a symbol table and im having a hard time writing get_symbol, which has the arguments of (symbol_table symtab, char sym). I have to write code for 2 functions get_symbol and set_symbol, I'm having some trouble understanding what a symbol…
Cka91405
  • 165
  • 1
  • 8
  • 17
-1
votes
1 answer

How do I get a function name in the symbol table to point to a different function?

On MacOS Ventura, obtaining a handle to the dynamic loader using dlopen(NULL, 0) returns a handle containing the entire executable's symbol table. Using this handle, one can obtain pointers to symbol data, access and modify their contents, and these…
jungon
  • 41
  • 1
  • 6
-1
votes
1 answer

How do I count the frequency of an item in a given range?

I've been given a lab where I'm supposed to create a program that reads a file with 1000 random integers between 10 to 59 inclusive and generate a frequency table like this: The ranges are 10 to 19, 20 to 29, 30 to 39, 40 to 49, and 50 to 59. Here…
-1
votes
1 answer

Create Iterable for BST-backed Symbol Table

For an assignment, I need to create an iterable that contains all keys for a symbol table backed by a binary search tree. I'm familiar with how to do this for a linked list, but can't seem to find any examples online about how to do this for a BST.…
Justin123
  • 57
  • 5
-1
votes
1 answer

Sorting symbol table by value in java

Symbol table give a result sorted by key but how can we sort the symbol table by values. I used Arrays.sort(st,st.get(key)) but gives me an error: cannot find symbol: method sort(ST,java.lang.Integer) My program look something like this. Still…
sam
  • 1
  • 1
1 2 3
13
14