Request for Community Feedback on g-code++ (sterp) Integration with LinuxCNC

More
07 Aug 2025 06:52 #332989 by smv
Hi everyone! I’ve recently been working on integrating g-code++ (a lightweight g-code interpreter inspired by the rs274ngc NIST g-code specification) into the LinuxCNC ecosystem. Before I submit a pull request, I’d like to get some community feedback so as to ensure that it fits well and is aligned with the project's direction.

Link to my original repo:  github.com/s-mv/gcode-plus-plus
Link to the LinuxCNC fork:  github.com/s-mv/linuxcnc/tree/s-mv/sterp (s-mv/sterp branch)
Demo video: 
What I’ve Done
  • Integrated g-code++ into the LinuxCNC environment.
  • Verified it works for 3-axis machines on LinuxCNC.
  • Documented the integration process and architecture.
  • Set up an ANTLR4-based parser for g-code interpretation.
Key features
  • Control flow: Support for
    while
    loops,
    for
    loops,
    if
    statements, imports,
    continue
    , and
    break.
  • g-code compatibility: Supports standard G-codes like G0, G1, G2, G3, G20, G21, G54, M3, M4, etc.
Feedback would be greatly appreciated, especially from people who have experience using g-code interpreters with LinuxCNC or have experience maintaining/debugging the project. Eager to make this integration as frictionless as possible so that it meets the needs of the community. Thanks in advance, and I’m looking forward to hearing your thoughts!

Best regards,
s-mv (Shreerang Vaidya)
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
08 Aug 2025 18:56 #333055 by andypugh
Does this exist as an alternative plug-in interpreter for LinuxCNC?

LinuxCNC already supports this, though the only alternative that currently exists is called canterp and just passes canonincal commands straight through.

I don't know how much traction you will get with a new G-code dialect, not even well-supported alternatives to G-code like STEP-NC have made much of a dent.

If it's a plug-in interpreter for existing LinuxCNC then I would support it's inclusion in principle.

Are you committed to supporting it for the next 20 years or so?
The following user(s) said Thank You: smv

Please Log in or Create an account to join the conversation.

More
09 Aug 2025 01:18 #333088 by pippin88
Please tell us the advantages of gcode++
The following user(s) said Thank You: smv

Please Log in or Create an account to join the conversation.

More
12 Aug 2025 14:18 #333278 by smv
Right now gcode++ extends g-code by introducing for loops, while/do-while loops, as well as imports (currently working on test cases for the same for the latest LinuxCNC release).

The inclusion of these control structures and import statements could greatly improve readability and code reusability.

It also ships with an in-house REPL for dry-running programs that can be used outside of LinuxCNC and has richer logging - I intend to add a simple debugger to it possibly in the future.

Please Log in or Create an account to join the conversation.

More
12 Aug 2025 14:40 #333279 by smv
Thanks a lot for reaching out!

Yes, in the current fork, it lives under src/emc/sterp as a plug-in interpreter.
In fact, I modeled it after studying how canterp works.

I understand that it might not gain much traction.

I'd love to maintain and extend the project as long as life permits me! Currently, I’m just an undergraduate, so I can’t promise a fixed 20-year roadmap just yet, but I've built sterp/gcode++ with maintainability in mind.
I might also extend it in the near future and add more preliminary unit tests.

Please Log in or Create an account to join the conversation.

More
19 Aug 2025 12:41 #333671 by andypugh

Right now gcode++ extends g-code by introducing for loops, while/do-while loops, as well as imports (currently working on test cases for the same for the latest LinuxCNC release).

You know that LinuxCNC G-code already has do/while loops? 

linuxcnc.org/docs/stable/html/gcode/o-code.html
 

Please Log in or Create an account to join the conversation.

More
20 Aug 2025 03:28 #333710 by cmorley
What do you mean "imports" ?
I would think that a more modern approach to parsing could be a good thing to get more people interested in working on the code.

Chris

Please Log in or Create an account to join the conversation.

More
21 Aug 2025 08:27 - 21 Aug 2025 09:06 #333751 by Grotius
In the source i see you how you handle expressions.

I shoukd use a lib like: mu parser to handle expressions. 
This also handles and updates gcode variables for you. 

It wont run (nested) while loops. This while loop algo you can design yourself.

in future i love to see gcode dialect parsing,
given a json config file.

Then hopely the interpreter is also able to read fanuc and kuka robot language and produce the motion outputs for it. An extended version off straight_feed xyz...
would look like straigt_feed j1 j2 ....

Mu parser example
Last edit: 21 Aug 2025 09:06 by Grotius.

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum