0 votes

As a weekend project, I need a process that would parse a script file of a "custom" language, read into godot and populate some scenes with logic (hint: it's part of an adventure game concept).

Is using GDNative C/C++ a good idea to implement a small lexer/parser and eval, assuming that in godot I might not be as comfortable to do these operations and they might clunky and slower?

in Engine by (72 points)

From my experience, small interpreters dont use too much cpu or ram, so gdscript should be fine, it has a pretty good match statement, but if you are more comfortable in c++, then just use that.

1 Answer

0 votes
Best answer

Godot has the Expression class, which can help parsing expressions for custom interpreters: https://docs.godotengine.org/en/stable/classes/class_expression.html

by (29,092 points)
selected by

Interesting, so the rest Lexer / Parser would be implemented as an autoload script, right?

Autoload is not required to use Expression, it's up to you how you set this up.

Just thinking out loud there :)

Thanks for your help very much!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.