]> www.ljiriste.work Git - SetSCAD.git/commitdiff
Create the basic idea of the grammar
authorLukáš Jiřiště <redacted>
Sun, 12 Jul 2026 20:41:30 +0000 (22:41 +0200)
committerLukáš Jiřiště <redacted>
Sun, 12 Jul 2026 20:41:30 +0000 (22:41 +0200)
.gitignore
Makefile
grammar [new file with mode: 0644]

index ea74a7851b49113c7e10210c317083dc6445eae9..c8d1d065588f17754efca9712b367a43d44954a8 100644 (file)
@@ -1,3 +1,4 @@
 *.pdf
 *.o
 setscad
+parsing_table
index b110ea4db8359cf0e34ab492e26a427855e919c1..02159fe9aca05285928b0d261d22debeb9ec0d15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
 
 README.pdf: README.typ
-       typst compile README.typ
+       typst compile $<
+
+parsing_table: grammar
+       $(RM) $@
+       parsing_table_generator $<
diff --git a/grammar b/grammar
new file mode 100644 (file)
index 0000000..af39522
--- /dev/null
+++ b/grammar
@@ -0,0 +1,62 @@
+set_named_definition -> set_name EQUAL LEFT_CURLY set_definition RIGHT_CURLY
+set_named_definition -> set_name EQUAL set
+set_definition -> points_domain VERTICAL_BAR constraint_list
+points_domain -> single_points_domain COMMA points_domain
+points_domain -> single_points_domain
+single_points_domain -> point COMMA single_points_domain
+single_points_domain -> point IN set
+point -> X
+point -> Y
+point -> Z
+constraint_list -> constraint
+constraint_list -> constraint logic_op constraint_list
+constraint -> LEFT_BRACKET constraint_list RIGHT_BRACKET
+constraint -> expression relation expression
+logic_op -> AND
+logic_op -> OR
+relation -> EQUAL
+relation -> LESS_THEN
+relation -> GREATER_THEN
+expression -> sum
+sum -> product PLUS sum
+sum -> product MINUS sum
+sum -> product
+product -> term TIMES product
+product -> term DIVIDE product
+product -> term
+term -> point
+term -> parameter_name
+term -> number
+term -> function_call
+term -> LEFT_BRACKET expression RIGHT_BRACKET
+function_call -> function_name LEFT_BRACKET argument_list RIGHT_BRACKET
+argument_list -> term COMMA argument_list
+argument_list -> term
+set_definition -> parameters_domain SEMICOLON parameter_equations
+parameters_domain -> parameter_name IN set COMMA parameters_domain
+parameters_domain -> parameter_name IN set
+parameter_equations -> parameter_equation COMMA parameter_equations
+parameter_equations -> parameter_equation
+parameter_equation -> point EQUAL expression
+set -> set_name
+set -> LEFT_BRACKET set set_op set RIGHT_BRACKET
+set -> transform set
+set_op -> UNION
+set_op -> INTERSECTION
+set_op -> DIFFERENCE
+set_op -> CARTESIAN_PRODUCT
+set_op -> MINKOWSKI_SUM
+transform -> rotation
+transform -> translate
+rotation -> ROTATE LEFT_BRACKET number COMMA axis COMMA set RIGHT_BRACKET
+translate -> TRANSLATE LEFT_BRACKET vector COMMA set RIGHT_BRACKET
+axis -> vector
+vector -> LEFT_SQUARE number COMMA number COMMA number RIGHT_SQUARE
+parameter_name -> NAME
+function_name -> NAME
+set_name -> NAME
+number -> mantissa
+number -> mantissa exponent
+mantissa -> INT
+mantissa -> INT DOT INT
+exponent -> EXP INT