go-csg

module
v0.0.0-...-2dc9ae7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2020 License: Apache-2.0

README

go-csg

GoDoc Test Status

An experimental CSG interpreter and converter written in Go.

CSG is an intermediate file format that is output by CAD tools such as OpenSCAD. See: https://github.com/openscad/openscad/wiki/CSG-File-Format for more information.

This project is based on the "Monkey language" from the book Writing An Interpreter in Go by Thorsten Ball: https://interpreterbook.com/

The goal of this project is to parse all valid CSG files and convert them to IRMF files in order to make IRMF accessible to more people.

Dependencies

  • Go version 1.13.4 or later

Running an example

You can use the run.sh bash script and the example number found in the examples directory to convert a CSG example file to IRMF.

$ ./run.sh 11
(ctrl-c to quit)

CSG Supported Features:

  • circle
  • cube
  • cylinder
  • difference
  • hull
  • intersection
  • linear_extrude
  • minkowski
  • multmatrix
  • polygon
  • polyhedron
  • projection
  • rotate_extrude
  • sphere
  • square
  • text
  • union

PRs are welcome! 😄


Enjoy!


License

Copyright 2019 Glenn M. Lewis. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
Package ast defines the Abstract Syntax Tree for our language.
Package ast defines the Abstract Syntax Tree for our language.
cmd
csg2irmf
csg2irmf reads a CSG file and writes out IRMF.
csg2irmf reads a CSG file and writes out IRMF.
repl
repl implements a language repl.
repl implements a language repl.
Package evaluator implements the language evaluator.
Package evaluator implements the language evaluator.
Package irmf defines the Abstract Syntax Tree for IRMF.
Package irmf defines the Abstract Syntax Tree for IRMF.
Package lexer implements the language lexer.
Package lexer implements the language lexer.
Package object implements the objects system for the language.
Package object implements the objects system for the language.
Package parser implements a parser for our programming language.
Package parser implements a parser for our programming language.
Package repl implements a Read, Eval, Print, Loop for our language.
Package repl implements a Read, Eval, Print, Loop for our language.
Package token tokenizes the input text.
Package token tokenizes the input text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL