T
T
Trrrrr2014-03-25 16:14:26
C++ / C#
Trrrrr, 2014-03-25 16:14:26

C++ - how to implement a console command parser?

It is necessary to implement a simple command parser in C++.
A good example of what I want to see can be found in games from Valve or Id Software.
Actually, the implementation options that came to my mind are as follows:
1) Use lua or python as a scripting language (in my opinion, it’s like a cannon on sparrows)
2) Open something from the boost, I didn’t google it right away.
3) A small library that implements the desired functionality. I also couldn't find anything good on the Internet.
Actually, what are the implementation options, so as not to write your bike?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Taratin, 2014-05-31
@Taraflex

https://github.com/id-Software/Quake-III-Arena/blo...

T
tsarevfs, 2014-03-25
@tsarevfs

If you need something more complicated than assignments, boost::python is not that hard to use.

A
AxisPod, 2014-03-26
@AxisPod

You do not need a parser, but a full-fledged scripting language. The parser can do nothing but parse, and you also need to do it.
So just take lua or python and go ahead, and they will parse the text themselves as it should.

A
afiskon, 2014-03-29
@afiskon

If you need a parser for something, take Flex and Bison.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question