antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.04k stars 3.27k forks source link

C++ Runtime on Embedded Systems Target #3405

Open irwineffect opened 2 years ago

irwineffect commented 2 years ago

I'm evaluating using ANTLR for use in an embedded systems context (C++, no operating system, single threaded, but with dynamic memory allocation support).

Poking around the C++ runtime source code, it appears that it uses several thread synchronization primitives (such as std::mutex) that my system does not have available.

I was curious if the ANTLR project has an interest in supporting this type of use case, or are embedded targets a non-goal of the project?

jcking commented 2 years ago

In theory we could add preprocessor defines that stripped the synchronization primitives, if you can guarantee its only ever single threaded. std::call_once would simply be substituted with a bool.

@mike-lischke

mike-lischke commented 2 years ago

I doubt this is something interesting for a significant amount of users. Because of the recursive nature ANTLR has a pretty high memory and stack pressure and would be useful only for very simple parsing tasks in such an embedded context.

I happily stay corrected if my assumption of the situation is wrong, but I'd need compelling reasons to change my mind.