how can i parse Script functions, variables, etc

Started by
7 comments, last by brightening-eyes 9 years, 10 months ago

hi all,

i'm developing a compiler for AngelScript using LLVM frontend

i have some questions:

how can i know what is the current line, it is a function? it is a variable, an expression, a statement, ETC!

and how can i know how many parameters does my function have, in order for LLVM to parse?

how can i know what is the return type?

how can i know the types of parameters?

how can i get a pointer to the script functions and objects?

thanks in advance

when you can't see well like me, you can't test your applications and you can't read something

Github

Advertisement

This is what the parser is made for :)

You can see the implementation I have for AngelScript in the as_parser.cpp file.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

thanks for your reply, but i want to know how can i parse these

for example, the library is compiled, how can i parse them? how can i know this line is a function, how many parameter does it have, what is the return type and anything else that may a compiler has

if you can, give a minimal example

thanks in advance

when you can't see well like me, you can't test your applications and you can't read something

Github

I'm not quite sure what you're asking for, but perhaps you can use the asIScriptModule interface to enumerate the functions that were compiled, and then use the asIScriptFunction interface to get the information about the parameters and return types for each of the functions.

The manual gives an overview of how all the entities are enumerated and inspected.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

well, thanks for these,but if i dont know the parameters, then what i should i do?

when you can't see well like me, you can't test your applications and you can't read something

Github

Please give an example of what you're trying to do so I can better understand what you're asking for and thus provide better help.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

i want to know what is executing, what function, what is the code, how many parameter does the function have, what is the variable name, what operation is currently is the script is doing, i want to plase them on the CPU registers and turn them into executables!

when you can't see well like me, you can't test your applications and you can't read something

Github

So you want to access the bytecode and interpret it?

That is best done by following the instructions for how to build a JIT compiler.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

thanks, i think i have found my answer, i didn't read ByteCode instructions

when you can't see well like me, you can't test your applications and you can't read something

Github

This topic is closed to new replies.

Advertisement