Oryginalna strona colobot.cba.pl umarła, gdy cba.pl przestało oferować darmowy hosting. To jest statyczny mirror, pobrany w 2018. ~krzys_h
 
Polski Portal COLOBOTa
COLOBOT Polish Portal

COLOBOT in general - Ceebot/Colobot robot language

Pendrokar - 25-08-2012, 15:47
Temat postu: Ceebot/Colobot robot language
Hi there,

I was wondering how Colobot parses the ingame programming language? I downloaded the source, but there is no index for the files.

So I thought I just ask. Does it parse the input as being C++ code with some different meanings added afterwards or does it go through the input from start to finish recognizing each symbol?

piotrdz - 26-08-2012, 14:42

The in-game language is called CBOT, and there is a library "CBot" (separate from main project), that deals with parsing and evaluating expressions in the language. The code is contained in src/CBot.

Basically, the CBot library behaves like most language parsers - the input is split into internal tokens (CBotToken). Then, the compiler creates instances of classes handling the language constructs like CBotWhile for while loops, CBotFloat for float constant, etc. The source is then represented as a tree of these objects. The actual execution is also an operation on the source tree (calling Execute() on all objects).

If you want more information, look at the comments in source code, now translated from French into English (dev branch). If you any questions about it, ask Zaba_999 or michkon on our IRC channel (#colobot at pirc.pl) since they were the ones working on it recently.

Pendrokar - 26-08-2012, 16:07

Since it does not parse CBOT as a C++ language, it is exactly what I was looking for in how to make and parse an internal programming language. Except I won't be using syntax of a programming language for what I'm trying to do. :roll:

Thanks piotrdz!


Powered by phpBB modified by Przemo & WRIM © 2003 phpBB Group