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.

187 questions
4
votes
1 answer

Hook and Replace Export Function in the Loaded ELF ( .so shared library )

I'm writing some C code to hook some function of .so ELF (shared-library) loaded into memory. My C code should be able to re-direct an export function of another .so library that was loaded into the app/program's memory. Here's a bit of…
Usman.3D
  • 1,753
  • 3
  • 16
  • 26
4
votes
0 answers

List all variable defined in bc command

Is it possible to list all variables (print symbol table) in bc command? For example $ bc -q x=3 y=4 z=x+y /* a command for listing all variables defined */ /* and it will show: x 3 y 4 z 7 or maybe in other format */ If saying "all defined…
tsh
  • 3,117
  • 3
  • 22
  • 40
4
votes
1 answer

GDB - How to handle "No Symbol Table"

I have an application I would like to inspect and I don't have the sources to rebuild it and create the Symbol Table like here (gcc -g my_app.c). When I call the info locals I get the following error "No symbol table info available" When I'm working…
MP_
  • 75
  • 1
  • 7
4
votes
3 answers

How do I access a constant in Perl whose name is contained in a variable?

I have a set of constants declared in Perl: use constant C1 => 111; use constant C2 => 222; .. use constant C9 => 999; my $which_constant = "C2"; How do I construct a Perl expression which, based on $which_constant, derives the value…
DVK
  • 119,765
  • 29
  • 201
  • 317
4
votes
1 answer

How is symbol table managed in a compiler

I wonder if there's only one symbol table that stores all the information about a source file, or there're multiple symbol tables that are stacked upon each other, and only fetched when current scope is related to the table. For example say I have…
Daniel
  • 1,418
  • 5
  • 21
  • 40
4
votes
4 answers

Matlab variable count limit

I have some C++ code that communicates with Matlab via the Engine C API. My code creates temporary variables in the Matlab workspace, which it diligently cleans up via clear calls as soon as possible. However, at some point, my application fails,…
Drew Hall
  • 26,700
  • 10
  • 58
  • 79
4
votes
0 answers

What are alternative ways to implement a symbol table in a compiler?

I'm writing a compiler for one of my classes this semester, and although I have a working implementation of a symbol table, I am a bit uncomfortable with its implementation. Since I'm doing the project in Python, I decided to go with an OO approach…
4
votes
1 answer

Strange behaviour, assigning undefined variable by reference

I am just exploring how Symbol Tables and Variable Containers work together with references. And I found out that doesn't throw a Notice saying "Undefined variable: b in...", while
Ruben
  • 65
  • 6
4
votes
1 answer

Compiler construction: Handle references to unordered symbols

I've got the dragonbook but it doesn't seem to handle that topic... In the most modern languages it's possible to use certain variables even if their appearance in the code is unordered. Example class Foo { void bar() { plonk = 42; …
Daniel
  • 2,581
  • 2
  • 19
  • 38
4
votes
2 answers

How exactly binding is done in closures?

function f() { return s; } // works fine though no `s` is defined yet ! var s=1; f(); // 1 delete s; var s=2; f(); // 2 (function() { var s=3; f(); // 2 and not 3 which means lexical scoping is at play (?) })(); first off, you can close over a…
Ashkan Kh. Nazary
  • 20,086
  • 13
  • 40
  • 60
4
votes
0 answers

LWUIT Symbol table

I'm facing a problem with symboltabel. I'm using Persian and English languages in my LWUIT application with the help of Localization. Now my problem is that when I press * button of any mobile device, some of the Symbol Tabel chars are getting…
aida
  • 143
  • 1
  • 9
3
votes
1 answer

Where symbol table gets stored?

I'm studying about compilers, and I suddenly got curious that if I compile a program (let's say test.c) with -g option, does an actual file with a symbol table gets created and stored somewhere or it just gets combined with the executable? I am…
3
votes
1 answer

How to interpret the st_info field of elf symbol table section

The man page has this to say: st_info This member specifies the symbol's type and binding attributes: STT_NOTYPE The symbol's type is not defined. STT_OBJECT The symbol is associated with a data…
Stephen
  • 2,194
  • 1
  • 21
  • 29
3
votes
1 answer

Computing stack demand for C++; How to get readable symbol table?

Assume that you have not only executable file, but also source code files. My problem is to calculate correct stack size of running process only for local variables, return address, passing argument. I was trying to use VMMap developed by MS.…
Hexoul
  • 161
  • 2
  • 13
3
votes
2 answers

Reference a variable by name in C++ by using Symbol Table

Basically what the title asks. Being a bit unfamiliar with C++, and the more advanced concepts such as symbol tables, I've looked into it online but am struggling to find any direction towards what my end goal is. Most of the tutorials I've seen…
MrMattL92
  • 33
  • 7
1 2
3
12 13