Oryginalna strona colobot.cba.pl umarła, gdy cba.pl przestało oferować darmowy hosting. To jest statyczny mirror, pobrany w 2018. ~krzys_h
|
Forum - Polski Portal COLOBOTa |
|
|
Ceebot/Colobot robot language |
Autor |
Wiadomość |
Pendrokar
Wiek: 29 Dołączył: 25 Sie 2012 Posty: 2 Skąd: Riga, Latvia
|
Wysłany: 25-08-2012, 15:47 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
Twoja ulubiona misja: programowanie ;)
Pomógł: 1 raz Dołączył: 17 Mar 2012 Posty: 55 Skąd: Częstochowa
|
Wysłany: 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
Wiek: 29 Dołączył: 25 Sie 2012 Posty: 2 Skąd: Riga, Latvia
|
Wysłany: 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.
Thanks piotrdz! |
|
|
|
|
|
Nie możesz pisać nowych tematów Możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum
|
Wersja do druku
|
|
| |
|
|
|
|
Polski Portal COLOBOTa © 2008 - 2012 |
|
|