discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Syntax documentation

JB
Jordan Brown
Wed, Nov 26, 2025 1:03 AM

I took a stab at making the syntax introduction a bit more formal and a
bit more correct.  I also switch the example style to one that I think
is more readable, especially for a new reader.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax

Please take a look and tell me what you think.

(The old text was actually technically incorrect, because it defined an
"action" as including an assignment, and said that you could put an
action after an operator... and you can't put an assignment after an
operator.)

I'm also starting on a more formal specification of the syntax:
https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal

Right now I'm trying to write that as prose, to make it a bit more
accessible than BNF or some other formal style.  However, I wouldn't be
surprised if as it gets filled in it needs to be more like BNF.  I'm
also not sure whether to layer it, introducing only a few concepts at a
time.  Comments, especially style comments, solicited.

I took a stab at making the syntax introduction a bit more formal and a bit more correct.  I also switch the example style to one that I think is more readable, especially for a new reader. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax Please take a look and tell me what you think. (The old text was actually technically incorrect, because it defined an "action" as including an assignment, and said that you could put an action after an operator... and you can't put an assignment after an operator.) I'm also starting on a more formal specification of the syntax: https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal Right now I'm trying to write that as prose, to make it a bit more accessible than BNF or some other formal style.  However, I wouldn't be surprised if as it gets filled in it needs to be more like BNF.  I'm also not sure whether to layer it, introducing only a few concepts at a time.  Comments, especially style comments, solicited.
FH
Father Horton
Wed, Nov 26, 2025 1:58 AM

"Each pair of braces creates a new scope inside the scope where they were
used."

I thought we just determined that's not the case.

On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

I took a stab at making the syntax introduction a bit more formal and a
bit more correct.  I also switch the example style to one that I think is
more readable, especially for a new reader.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax

Please take a look and tell me what you think.

(The old text was actually technically incorrect, because it defined an
"action" as including an assignment, and said that you could put an action
after an operator... and you can't put an assignment after an operator.)

I'm also starting on a more formal specification of the syntax:
https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal

Right now I'm trying to write that as prose, to make it a bit more
accessible than BNF or some other formal style.  However, I wouldn't be
surprised if as it gets filled in it needs to be more like BNF.  I'm also
not sure whether to layer it, introducing only a few concepts at a time.
Comments, especially style comments, solicited.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

"Each pair of braces creates a new scope inside the scope where they were used." I thought we just determined that's not the case. On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > I took a stab at making the syntax introduction a bit more formal and a > bit more correct. I also switch the example style to one that I think is > more readable, especially for a new reader. > > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax > > Please take a look and tell me what you think. > > (The old text was actually technically incorrect, because it defined an > "action" as including an assignment, and said that you could put an action > after an operator... and you can't put an assignment after an operator.) > > > I'm also starting on a more formal specification of the syntax: > https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal > > Right now I'm trying to write that as prose, to make it a bit more > accessible than BNF or some other formal style. However, I wouldn't be > surprised if as it gets filled in it needs to be more like BNF. I'm also > not sure whether to layer it, introducing only a few concepts at a time. > Comments, especially style comments, solicited. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jordan Brown
Wed, Nov 26, 2025 3:11 AM

On 11/25/2025 5:58 PM, Father Horton wrote:

"Each pair of braces creates a new scope inside the scope where they
were used."

All that I touched in this change was the top section, the section now
labelled "Introduction to Syntax".

I thought we just determined that's not the case.

Correct.  (And it says that about two paragraphs below.)  But indeed
it's bad to say "X" and then paragraphs later say "but not X-prime"
https://www.imdb.com/title/tt0082971/quotes/?item=qt0450570.  That can
lead to digging in the wrong place
https://www.imdb.com/title/tt0082971/quotes/?item=qt0450559.

I don't really want to take on a massive cleanup at this time, but I did
just now add a phrase there:

Each pair of braces grouping "children" of an operator creates a new
scope inside the scope where they were used.

On 11/25/2025 5:58 PM, Father Horton wrote: > "Each pair of braces creates a new scope inside the scope where they > were used." All that I touched in this change was the top section, the section now labelled "Introduction to Syntax". > I thought we just determined that's not the case. Correct.  (And it says that about two paragraphs below.)  But indeed it's bad to say "X" and then paragraphs later say "but not X-prime" <https://www.imdb.com/title/tt0082971/quotes/?item=qt0450570>.  That can lead to digging in the wrong place <https://www.imdb.com/title/tt0082971/quotes/?item=qt0450559>. I don't really want to take on a massive cleanup at this time, but I did just now add a phrase there: > Each pair of braces grouping "children" of an operator creates a new > scope inside the scope where they were used.
FH
Father Horton
Wed, Nov 26, 2025 3:52 AM

I have a proofreader’s mind. Maybe I should create an account and help on
the docs.

On Tue, Nov 25, 2025 at 9:12 PM Jordan Brown openscad@jordan.maileater.net
wrote:

On 11/25/2025 5:58 PM, Father Horton wrote:

"Each pair of braces creates a new scope inside the scope where they were
used."

All that I touched in this change was the top section, the section now
labelled "Introduction to Syntax".

I thought we just determined that's not the case.

Correct.  (And it says that about two paragraphs below.)  But indeed it's
bad to say "X" and then paragraphs later say "but not X-prime"
https://www.imdb.com/title/tt0082971/quotes/?item=qt0450570.  That can
lead to digging in the wrong place
https://www.imdb.com/title/tt0082971/quotes/?item=qt0450559.

I don't really want to take on a massive cleanup at this time, but I did
just now add a phrase there:

Each pair of braces grouping "children" of an operator creates a new scope
inside the scope where they were used.

I have a proofreader’s mind. Maybe I should create an account and help on the docs. On Tue, Nov 25, 2025 at 9:12 PM Jordan Brown <openscad@jordan.maileater.net> wrote: > On 11/25/2025 5:58 PM, Father Horton wrote: > > "Each pair of braces creates a new scope inside the scope where they were > used." > > > All that I touched in this change was the top section, the section now > labelled "Introduction to Syntax". > > I thought we just determined that's not the case. > > > Correct. (And it says that about two paragraphs below.) But indeed it's > bad to say "X" and then paragraphs later say "but not X-prime" > <https://www.imdb.com/title/tt0082971/quotes/?item=qt0450570>. That can > lead to digging in the wrong place > <https://www.imdb.com/title/tt0082971/quotes/?item=qt0450559>. > > I don't really want to take on a massive cleanup at this time, but I did > just now add a phrase there: > > Each pair of braces grouping "children" of an operator creates a new scope > inside the scope where they were used. > > >
BC
Bob Carlson
Wed, Nov 26, 2025 10:57 PM

I did not read every word, but it strikes me as very good. I had only small niggles about a few things. Only one seems worth mentioning. Assignment is mentioned right up front. The single most confusing thing I found in OS was the unchangeable “variable”. I would mention this here and not wait. Something like “The value assigned to a name may not be changed within a scope. Scope is covered below.”

-Bob

On Nov 25, 2025, at 18:58, Father Horton via Discuss discuss@lists.openscad.org wrote:

"Each pair of braces creates a new scope inside the scope where they were used."

I thought we just determined that's not the case.

On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss <discuss@lists.openscad.org mailto:discuss@lists.openscad.org> wrote:

I took a stab at making the syntax introduction a bit more formal and a bit more correct.  I also switch the example style to one that I think is more readable, especially for a new reader.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax

Please take a look and tell me what you think.

(The old text was actually technically incorrect, because it defined an "action" as including an assignment, and said that you could put an action after an operator... and you can't put an assignment after an operator.)

I'm also starting on a more formal specification of the syntax: https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal

Right now I'm trying to write that as prose, to make it a bit more accessible than BNF or some other formal style.  However, I wouldn't be surprised if as it gets filled in it needs to be more like BNF.  I'm also not sure whether to layer it, introducing only a few concepts at a time.  Comments, especially style comments, solicited.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org_______________________________________________

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I did not read every word, but it strikes me as very good. I had only small niggles about a few things. Only one seems worth mentioning. Assignment is mentioned right up front. The single most confusing thing I found in OS was the unchangeable “variable”. I would mention this here and not wait. Something like “The value assigned to a name may not be changed within a scope. Scope is covered below.” -Bob > On Nov 25, 2025, at 18:58, Father Horton via Discuss <discuss@lists.openscad.org> wrote: > > "Each pair of braces creates a new scope inside the scope where they were used." > > I thought we just determined that's not the case. > > On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss <discuss@lists.openscad.org <mailto:discuss@lists.openscad.org>> wrote: >> I took a stab at making the syntax introduction a bit more formal and a bit more correct. I also switch the example style to one that I think is more readable, especially for a new reader. >> >> https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax >> >> Please take a look and tell me what you think. >> >> (The old text was actually technically incorrect, because it defined an "action" as including an assignment, and said that you could put an action after an operator... and you can't put an assignment after an operator.) >> >> >> I'm also starting on a more formal specification of the syntax: https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal >> >> Right now I'm trying to write that as prose, to make it a bit more accessible than BNF or some other formal style. However, I wouldn't be surprised if as it gets filled in it needs to be more like BNF. I'm also not sure whether to layer it, introducing only a few concepts at a time. Comments, especially style comments, solicited. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org>_______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jordan Brown
Fri, Nov 28, 2025 1:14 AM

On 11/26/2025 2:57 PM, Bob Carlson via Discuss wrote:

I did not read every word, but it strikes me as very good. I had only
small niggles about a few things. Only one seems worth mentioning.
Assignment is mentioned right up front. The single most confusing
thing I found in OS was the unchangeable “variable”. I would mention
this here and not wait. Something like “The value assigned to a name
may not be changed within a scope. Scope is covered below.”

Note:  the only part that I changed in this particular edit is the very
top section, now labelled "Introduction to Syntax".

That section does have one line on assignments.  I would not want to add
any more detail there, because there are a zillion details that somebody
might want to know about items in this section... and it's an
introduction to syntax section; it doesn't cover the details.

The "cannot be changed" semantic (which my OCD points out is a semantic,
not syntax) is discussed in the third or fourth paragraph under
"Variables" below.  It could perhaps be pulled up a little - and maybe
some of the text in the sections above should be pulled out into
"detail" sections below, so that we could go through all of the major
concepts at a high level before diving into the details on any of them. 
I'll look at that.

On 11/26/2025 2:57 PM, Bob Carlson via Discuss wrote: > I did not read every word, but it strikes me as very good. I had only > small niggles about a few things. Only one seems worth mentioning. > Assignment is mentioned right up front. The single most confusing > thing I found in OS was the unchangeable “variable”. I would mention > this here and not wait. Something like “The value assigned to a name > may not be changed within a scope. Scope is covered below.” Note:  the only part that I changed in this particular edit is the very top section, now labelled "Introduction to Syntax". That section does have one line on assignments.  I would not want to add any more detail there, because there are a zillion details that somebody might want to know about items in this section... and it's an introduction to syntax section; it doesn't cover the details. The "cannot be changed" semantic (which my OCD points out is a semantic, not syntax) is discussed in the third or fourth paragraph under "Variables" below.  It could perhaps be pulled up a little - and maybe some of the text in the sections above should be pulled out into "detail" sections below, so that we could go through all of the major concepts at a high level before diving into the details on any of them.  I'll look at that.
SL
Steve Lelievre
Fri, Nov 28, 2025 2:01 AM

Look okay to me. I found it all basically clear.

My thanks go to you and to everyone who works on OpenSCAD, for your efforts.

Steve

On Tue, 25 Nov 2025 at 17:03, Jordan Brown via Discuss <
discuss@lists.openscad.org> wrote:

I took a stab at making the syntax introduction a bit more formal and a
bit more correct.  I also switch the example style to one that I think is
more readable, especially for a new reader.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax

Please take a look and tell me what you think.

(The old text was actually technically incorrect, because it defined an
"action" as including an assignment, and said that you could put an action
after an operator... and you can't put an assignment after an operator.)

I'm also starting on a more formal specification of the syntax:
https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal

Right now I'm trying to write that as prose, to make it a bit more
accessible than BNF or some other formal style.  However, I wouldn't be
surprised if as it gets filled in it needs to be more like BNF.  I'm also
not sure whether to layer it, introducing only a few concepts at a time.
Comments, especially style comments, solicited.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Look okay to me. I found it all basically clear. My thanks go to you and to everyone who works on OpenSCAD, for your efforts. Steve On Tue, 25 Nov 2025 at 17:03, Jordan Brown via Discuss < discuss@lists.openscad.org> wrote: > I took a stab at making the syntax introduction a bit more formal and a > bit more correct. I also switch the example style to one that I think is > more readable, especially for a new reader. > > > https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax > > Please take a look and tell me what you think. > > (The old text was actually technically incorrect, because it defined an > "action" as including an assignment, and said that you could put an action > after an operator... and you can't put an assignment after an operator.) > > > I'm also starting on a more formal specification of the syntax: > https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal > > Right now I'm trying to write that as prose, to make it a bit more > accessible than BNF or some other formal style. However, I wouldn't be > surprised if as it gets filled in it needs to be more like BNF. I'm also > not sure whether to layer it, introducing only a few concepts at a time. > Comments, especially style comments, solicited. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
FH
Father Horton
Mon, Dec 1, 2025 3:08 AM

Is there any particular reason that inf and nan are not pre-defined?

Is there any particular reason that inf and nan are not pre-defined? >
JB
Jon Bondy
Mon, Dec 1, 2025 4:07 PM

I find that

!{
some code
}

gets a compiler error, but

!translate([0, 0, 0]){
some code
}

is OK.  Is this what would be expected?

Jon

On 11/26/2025 5:57 PM, Bob Carlson via Discuss wrote:

I did not read every word, but it strikes me as very good. I had only
small niggles about a few things. Only one seems worth mentioning.
Assignment is mentioned right up front. The single most confusing
thing I found in OS was the unchangeable “variable”. I would mention
this here and not wait. Something like “The value assigned to a name
may not be changed within a scope. Scope is covered below.”

-Bob

On Nov 25, 2025, at 18:58, Father Horton via Discuss
discuss@lists.openscad.org wrote:

"Each pair of braces creates a new scope inside the scope where they
were used."

I thought we just determined that's not the case.

On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss
discuss@lists.openscad.org wrote:

 I took a stab at making the syntax introduction a bit more formal
 and a bit more correct.  I also switch the example style to one
 that I think is more readable, especially for a new reader.

 https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax
 <https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikibooks.org_wiki_OpenSCAD-5FUser-5FManual_General-23Introduction-5Fto-5FSyntax&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AsrE-c7ZR7B2Kyr3qgfvvppkCEBVsNmwEMndcrRSuOI&m=ms1ClgsRUb3s89SmfD3BL4d2tJPEg0TIFCIN3V1ugO3xKFGKdcVSZgyNg-TQDFPK&s=9zARm1uIwNBFr0Z3yF784NjRtIjMYB2V5vInIUtz3mw&e=>

 Please take a look and tell me what you think.

 (The old text was actually technically incorrect, because it
 defined an "action" as including an assignment, and said that you
 could put an action after an operator... and you can't put an
 assignment after an operator.)


 I'm also starting on a more formal specification of the syntax:
 https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal
 <https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikibooks.org_wiki_User-3AJordan-5FBrown_Formal&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AsrE-c7ZR7B2Kyr3qgfvvppkCEBVsNmwEMndcrRSuOI&m=ms1ClgsRUb3s89SmfD3BL4d2tJPEg0TIFCIN3V1ugO3xKFGKdcVSZgyNg-TQDFPK&s=RjIr4EW3cHZR3zBqJGMeLOGczrWFUqjkUgzQKH5DoGc&e=>

 Right now I'm trying to write that as prose, to make it a bit
 more accessible than BNF or some other formal style.  However, I
 wouldn't be surprised if as it gets filled in it needs to be more
 like BNF. I'm also not sure whether to layer it, introducing only
 a few concepts at a time.  Comments, especially style comments,
 solicited.
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

I find that !{ some code } gets a compiler error, but !translate([0, 0, 0]){ some code } is OK.  Is this what would be expected? Jon On 11/26/2025 5:57 PM, Bob Carlson via Discuss wrote: > I did not read every word, but it strikes me as very good. I had only > small niggles about a few things. Only one seems worth mentioning. > Assignment is mentioned right up front. The single most confusing > thing I found in OS was the unchangeable “variable”. I would mention > this here and not wait. Something like “The value assigned to a name > may not be changed within a scope. Scope is covered below.” > > -Bob > >> On Nov 25, 2025, at 18:58, Father Horton via Discuss >> <discuss@lists.openscad.org> wrote: >> >> "Each pair of braces creates a new scope inside the scope where they >> were used." >> >> I thought we just determined that's not the case. >> >> On Tue, Nov 25, 2025 at 7:03 PM Jordan Brown via Discuss >> <discuss@lists.openscad.org> wrote: >> >> I took a stab at making the syntax introduction a bit more formal >> and a bit more correct.  I also switch the example style to one >> that I think is more readable, especially for a new reader. >> >> https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Introduction_to_Syntax >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikibooks.org_wiki_OpenSCAD-5FUser-5FManual_General-23Introduction-5Fto-5FSyntax&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AsrE-c7ZR7B2Kyr3qgfvvppkCEBVsNmwEMndcrRSuOI&m=ms1ClgsRUb3s89SmfD3BL4d2tJPEg0TIFCIN3V1ugO3xKFGKdcVSZgyNg-TQDFPK&s=9zARm1uIwNBFr0Z3yF784NjRtIjMYB2V5vInIUtz3mw&e=> >> >> Please take a look and tell me what you think. >> >> (The old text was actually technically incorrect, because it >> defined an "action" as including an assignment, and said that you >> could put an action after an operator... and you can't put an >> assignment after an operator.) >> >> >> I'm also starting on a more formal specification of the syntax: >> https://en.wikibooks.org/wiki/User:Jordan_Brown/Formal >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikibooks.org_wiki_User-3AJordan-5FBrown_Formal&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=AsrE-c7ZR7B2Kyr3qgfvvppkCEBVsNmwEMndcrRSuOI&m=ms1ClgsRUb3s89SmfD3BL4d2tJPEg0TIFCIN3V1ugO3xKFGKdcVSZgyNg-TQDFPK&s=RjIr4EW3cHZR3zBqJGMeLOGczrWFUqjkUgzQKH5DoGc&e=> >> >> Right now I'm trying to write that as prose, to make it a bit >> more accessible than BNF or some other formal style.  However, I >> wouldn't be surprised if as it gets filled in it needs to be more >> like BNF. I'm also not sure whether to layer it, introducing only >> a few concepts at a time.  Comments, especially style comments, >> solicited. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG antivirus software. www.avg.com
JB
Jordan Brown
Mon, Dec 1, 2025 4:20 PM

On 11/30/2025 4:38 AM, Jon Bondy via Discuss wrote:

I find that 

!{
some code
}

gets a compiler error, but 

!translate([0, 0, 0]){
some code

is OK.  Is this what would be expected?

It doesn't surprise me.  "Anonymous scopes" are very much a second-class
citizen.  I think we'd be better off if they were an implied union(),
but in theory that's incompatible with somebody who just used them for
visual grouping and collapsing in the editor.

On 11/30/2025 4:38 AM, Jon Bondy via Discuss wrote: > > I find that  > > !{ > some code > } > > gets a compiler error, but  > > !translate([0, 0, 0]){ > some code > }  > > is OK.  Is this what would be expected? > It doesn't surprise me.  "Anonymous scopes" are very much a second-class citizen.  I think we'd be better off if they were an implied union(), but in theory that's incompatible with somebody who just used them for visual grouping and collapsing in the editor.