symbol-table

Reusing symbol table from semantic analysis phase for code generation

大兔子大兔子 提交于 2019-12-11 11:17:40
问题 I'm currently building a compiler for a language which has global variable and nested subroutine feature. Previously, I've only ever built a compiler for languages which only has local variable without nested subroutine. I have a problem on how to reuse symbol table filled during semantic analysis phase in code generation phase. I make the symbol table as a stack of linked list, where each linked list represents identifiers declared in a particular scope. Every time it enters a scope, a new

Accessing symbol table in .class files

↘锁芯ラ 提交于 2019-12-11 09:32:57
问题 For an arbitrary code base in Java, I want to create a table (conceptually) of USES and USED-BY relations between symbols and types. A symbol table has the information I need. However, writing a front end seems like a huge task and threatens to turn my project into an even bigger sub-project. There's no reason for this, it seems to me ,because bytecode, the Java .class file necessarily contains within it such a symbol table for each class so that it can resolve types and references. My

How to interpret the st_info field of elf symbol table section

拈花ヽ惹草 提交于 2019-12-11 02:28:12
问题 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 object. STT_FUNC The symbol is associated with a function or other executable code. STT_SECTION The symbol is associated with a section. Symbol table entries of this type exist primarily for relocation and normally have STB_LOCAL bindings. STT_FILE By convention, the symbol's name gives the name of

lex and yacc (symbol table generation)

一世执手 提交于 2019-12-10 17:11:44
问题 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 to yacc.I tried to looking into it but didn't get much info. Could I know the other applications where lex and yacc are used apart from compiler designs. 回答1: A symbol table is a global data structure that can be used in all stages/phases/passes of

C global static variable initialization is done by linker?

為{幸葍}努か 提交于 2019-12-08 10:36:06
问题 Let's say we have: f1.c #include <stdio.h> static int x = 10; void f1() { printf("f1.c : %d\n", x); } main.c extern void f1(); int main(int argc, char **argv) { f1(); return 0; } we will compile and read the two ELF file symboltables (rel. ELF and exec ELF): $> gcc -c *.c $> readelf -s f1.o | grep x Num: Value Size Type Bind Vis Ndx Name 5: 0000000000000000 4 OBJECT LOCAL DEFAULT 3 x $> gcc *.o $> readelf -s a.out | grep x Num: Value Size Type Bind Vis Ndx Name 38: 0000000000601038 4 OBJECT

How to make a symbol table

送分小仙女□ 提交于 2019-12-07 02:27:01
问题 We have as an assignment to make a compiler. We have already made the lexical and syntax analysis but we are stuck at generation of intermediate code. We realized that we have to implement a symbol table in order to proceed to intermediate code generation and we don't know, how to do it and what it contains. Given the code below, what should the symbol table contain? (The code is written in an educational language which is described below) Also how can we implement scopes in our symbol table?

Symbol Table Population after parsing; Compiler building

狂风中的少年 提交于 2019-12-06 15:07:48
问题 After creating the parse tree, i have to populate symbol table now. I have to store information like Type, Scope, Offset etc for the identifiers. Now how do i know the type, scope of the identifiers , since all i know is the lexeme value and line number for that particular ID (after lexical analysis). How do i got about the whole thing. thanks. 回答1: Now how do i know the type, scope of the identifiers , since all i know is the lexeme value and line number for that particular ID (after lexical

Symbol Table Population after parsing; Compiler building

跟風遠走 提交于 2019-12-04 21:59:31
After creating the parse tree, i have to populate symbol table now. I have to store information like Type, Scope, Offset etc for the identifiers. Now how do i know the type, scope of the identifiers , since all i know is the lexeme value and line number for that particular ID (after lexical analysis). How do i got about the whole thing. thanks. Now how do i know the type, scope of the identifiers , since all i know is the lexeme value and line number for that particular ID (after lexical analysis). As EJP mentioned, you need to step through the parse tree. Your tree should have been created so

Symbol Resolution and Dynamic Linking

↘锁芯ラ 提交于 2019-12-04 10:30:47
I have been reading about the relocation and symbol resolution process and I have a few questions on the same. So the whole process(of loading the exec) starts with exec(BA_OS) command. During exec(BA_OS) , the system retrieves a path name from the PT_INTERP segment and creates the initial process image from the interpreter file’s segments. That is, instead of using the original executable file’s segment images, the system composes a memory image for the interpreter. It then is the interpreter’s responsibility to receive control from the system and provide an environment for the application

symbol lookup error: ./executableName: undefined symbol: _ZN18QXmlDefaultHandlerC2Ev

独自空忆成欢 提交于 2019-12-03 12:34:35
I am trying to run an executable on Linux Mint 16 x64 that was compiled for Ubuntu 12 x64. The executable uses Qt 5.1.1 dynamically during runtime. I get the error: loaded the dummy plugin loaded the Linux plugin updating server status ./executableName: symbol lookup error: ./executableName: undefined symbol: _ZN18QXmlDefaultHandlerC2Ev When I run ldd executableName | grep "not found" searching for missing dependencies I get no result; all dynamic dependencies seem to be found, but the undefined symbol error above persists. Thoughts? A quick help: $ echo _ZN18QXmlDefaultHandlerC2Ev|c++filt