Page 1 of 1

Semantic Analysis and Parsing on the PS2

Posted: Thu Apr 24, 2008 3:03 am
by whatisdot
Hello again,

I have another question for you guys. For those of you who know about semantic analysis and programs that do this for us (yacc, lex, flex, bison, etc). Are there any programs or libraries right now for doing this on the PS2? I haven't seen anything like this in the PS2SDK, but maybe I haven't looked hard enough... I know about the linux port on the PS2, so I figured there had to be SOMETHING like this available out there.
If no one has been working on something like this, then I might just take up the challenge. Programs like these would be a very powerful tool for developers.

In the grand scheme of things, I would like to implement a makeshift shell to work as an interface to the system, as well as being a safety layer. Getting all of those memory errors are a bit frustrating =) I tried messing around with 'radshell' but I couldn't get it to run properly on my PS2.

Posted: Thu Apr 24, 2008 7:55 pm
by orphean
Things like flex and bison simply take in a grammar, process it, and spit out a c source file. So you wouldn't need to create special binaries to do that.

For the library components to the tools you could simply build them using the ps2 toolchain and link it in like any other library.

I don't see why this would require specialized ps2 libs I suppose.

Posted: Fri May 02, 2008 3:08 am
by whatisdot
I have been playing around with flex and bison and trying to get them to link properly. I have been running into some problems, though. I keep getting this error when it comes to linking:

Code: Select all

/usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.2/../../../../ee/bin/ld: y.tab.o: Relocations in generic ELF (EM: 62)
y.tab.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [pclis.elf] Error 1
I could swear that I saw lex and bison being used when I was running the Toolchain, but I just can't get them to link properly with EE-GCC. All the searches I have done on this issue basically say there's nothing to do about it. I guess it just can't be done... =( It's a real shame, because this would make life easier for developers making complex apps for the PS2.

Maybe I'll just have to build my own...

Posted: Fri May 02, 2008 3:47 am
by Mega Man
You are using the wrong compiler. The file "y.tab.o" was created by your native host compiler, but you need to use the ee-gcc cross compiler.

Posted: Fri May 02, 2008 6:37 am
by whatisdot
Thanks for the heads up, Mega Man. I fixed that problem and ran into another one. The compiler is spitting back some weird errors. I think it has to do with dependencies, but I don't know that much about what is happening...

Code: Select all

y.tab.o(.text+0x324): In function `yyparse':
y.tab.c: undefined reference to `yylex'
y.tab.o(.data+0x11): In function `yyerror(char const*)':
y.tab.c: undefined reference to `__gxx_personality_v0'
lex.yy.o(.text+0x44): In function `yylex()':
lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.text+0x48):lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.text+0x60):lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.text+0x64):lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.text+0x324):lex.yy.c: undefined reference to `atoi'
lex.yy.o(.text+0x53c):lex.yy.c: undefined reference to `yywrap'
lex.yy.o(.text+0x9b0): In function `yy_get_next_buffer()':
lex.yy.c: undefined reference to `__srget'
lex.yy.o(.text+0x12a4): In function `yyinput()':
lex.yy.c: undefined reference to `yywrap'
lex.yy.o(.text+0x17b0): In function `yy_init_buffer(yy_buffer_state*, __sFILE*)':
lex.yy.c: undefined reference to `isatty'
lex.yy.o(.text+0x1e48): In function `yy_fatal_error(char const*)':
lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.text+0x1e4c):lex.yy.c: undefined reference to `_impure_ptr'
lex.yy.o(.data+0x11): In function `yylex()':
lex.yy.c: undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Posted: Fri May 02, 2008 9:21 am
by Mega Man
You used at least for one C file the compiler ee-g++. Then you need to use it also as the linker. When you want to access a C++ symbol from C, you need to place a "extern "C" { ... }" around it.