Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Script Compiler

This topic is 6018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to develop a script compiler and i don''t really know how to translate an ascii text into some kind of byte-code. I wrote some *very* simple programs to compile a few functions into a bytecode file, where the function name and its address was stored in the file header, so you could directly access every function and call it from within the bytecode-interpreter. but, maybe because i have quite less knowledge in building a compiler, these programs somehow failed when i''d tried to extend them to have a fully-functional scripting language. so, does anyone know how to build a script-compiler/interpreter or where to search for information on how to do this ? thx

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
It''s a bit tricky but not so difficult. You can use tools like yacc and lex (or bison and flex) to define your grammar and parse the code. There''s a tutorial on flipcode (http://www.flipcode.com/tutorials/ - at the bottom) and i think i also saw something on gamedev...

But often (if you have a very simple scripting language) you don''t compile bytecode but build a syntax-tree while parsing and execute that tree directly.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!