I understand the basic parsing for the majority of common cases can be done
fairly easily, but this seems rather error-prone for something that will
eventually be moving a machine.  I am hoping to build something that is
more robust for handling, e.g. inline comments and all of the other special
cases present in the specification.  I then want to expand it further to
perform validation and normalization of the gcode, splitting lines, etc.

There is seemingly a grammar for the language that could be used to

http://www.isd.mel.nist.gov/documents/kramer/RS274VGER_11.pdf  around page
60.

Unless something like this exists, my plan would be to use a parser
generator like antlr to build a parser using that grammar, and then
implement the validation on top of that, verifying using for instance the
modal group rules here:

http://www.linuxcnc.org/docview/html/gcode_overview.html

And ordering things per the actual order of execution rules.  My hope is
that then I will be able to safely use a simple text-based transformation
against the output of this process after the file has been parsed,
normalized and validated.  I am hoping someone at some point did most of
that work, though, in a way that can be used from python in EMC2.

Hope that helps clarify,

Scott

On Sat, Jan 21, 2012 at 1:10 PM, Ed Nisley <ed.08.nis...@pobox.com> wrote:

> On Sat, 2012-01-21 at 12:44 -0600, Jon Elson wrote:
> > Every numeric value is preceded by a letter telling what it is.
>
> Except in the wonderful world of RepRap, wherein they're now
> (contemplating?) dual-extruder "G-Code" with multiple numeric values
> after the E axis to mix / simultaneously extrude multiple materials:
>
> http://reprap.org/wiki/G-code#M160:_Number_of_mixed_materials
>
> The E axis must then absorb a linear "distance" of filament, plus the
> mix fractions for each material.
>
> The RepRap dialect seems to be diverging fairly rapidly from what the
> LinuxCNC parser understands; in particular, their myriad M codes look
> like a problem.
>
> --
> Ed
> http://softsolder.com
>
>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to