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
4
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,613
  • 1
  • 24
  • 42
4
votes
1 answer

lex and yacc (symbol table generation)

I am new to lex and yacc and compiler design. I would like to know at which phase(lexical, syntactical or any other phase) and how the symbol table is generated? Can I have a brief description of y.output file which is generated by giving -v option…
Tech Freak
  • 43
  • 1
  • 3
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,791
  • 3
  • 16
  • 27
4
votes
1 answer

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
  • 4,263
  • 5
  • 28
  • 47
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
  • 126,886
  • 32
  • 213
  • 327
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,484
  • 5
  • 24
  • 42
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
  • 28,429
  • 12
  • 61
  • 81
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,993
  • 2
  • 23
  • 40
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
  • 21,844
  • 13
  • 44
  • 68
4
votes
1 answer

Build symbol table from grammar

I am trying to build a symbol table from my grammar (done with antlr) by using eclipse. However I don't know by what to begin. I think I read somewhere that you would need the parser and lexer generated by antlr to do that. Does someone know an easy…
Exia0890
  • 441
  • 6
  • 21
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
  • 153
  • 1
  • 9
3
votes
2 answers

List of subroutines current package declares

Need to gather a list of the subroutines that the current package itself declares - no imports. I've seen Package::Stash, but it lists imported names (of course). Came up with the following, but I don't like having to move the includes to the bottom…
robut
  • 341
  • 1
  • 9
1 2
3
13 14