Alternate parser

5 views
Skip to first unread message

Kelvin Cookshaw

unread,
Jul 19, 2016, 12:36:08 PM7/19/16
to impli...@googlegroups.com

I've made some progress in writing a new expression parser for ExtOpenscad.
It seems pretty quick, and I've expanded the suite of tests Julia wrote for the parser. I hope to have it parsing expressions fully within a week or so.

I've added some thoughts to the wiki on my clone of the repo:
https://github.com/Cookshak/ImplicitCAD/wiki/Plan

I haven't checked in the lines that make statement and tests use the new parser, which I realize I should do tonight.

The parser is predictive and does not do backtracking, making it fast for large expressions.

All comments are welcome and appreciated.

Cheers,
Kelvin


On Jul 16, 2016 11:51 AM, "Kelvin Cookshaw" <kel...@cookshaw.com> wrote:
Compatibility with OpenSCAD is the feature that got me interested in ImplicitCAD, and this may have also hooked some others in. It's ability to quickly process my existing SCAD files is pretty important to me.

I'm finding the parsing of some files to be quite slow, possibly due to the extensive use of 'try' to perform look ahead in expressions. It seems like large expressions throw it for a loop, but I haven't benchmarked expressions of different depths.

Also, I've found quite a few SCAD files I've downloaded do not parse at all, and the parser message is usually not very specific. For example, the parser cannot parse a ternary operator that starts with a comparison, like this: a < b ? 3 : 4

I would like ImplicitCAD to be able to quickly parse the entire set of OpenSCAD-compatible files, and provide helpful error messages when it doesn't support a feature, or when there is a syntax error in the source.

On the other hand, changing the existing parser to recognize all OpenSCAD files might break some files written specifically for ImplicitCAD, which will never be opened in OpenSCAD.

Here's what I would like to propose:
a. Continue to support the existing parser as the default;
b. Write a new parser, faster and 100% compatible with OpenSCAD;
c. Provide a command line argument or a separate executable to choose the newer parser.

Is this plan acceptable or of interest to people here? I would like to do this, but I want to know what everybody else thinks.

Thanks for your time,
Kelvin

Julia Longtin

unread,
Aug 10, 2016, 12:28:23 PM8/10/16
to Kelvin Cookshaw, impli...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "ImplicitCAD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to implicitcad+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kelvin Cookshaw

unread,
Aug 11, 2016, 7:55:35 PM8/11/16
to Julia Longtin, impli...@googlegroups.com

Thanks, Julia, that's a great collection.
Kelvin

Reply all
Reply to author
Forward
0 new messages