GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - 1T17/GGcode: parametric scripting language for generating G-code

BranchesTags
Open more actions menu

Latest commit

 

History

94 Commits
94 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE
 
 
GGCODE
GGCODE
 
 
GGcode_protocolware
GGcode_protocolware
 
 
src
src
 
 
tests
tests
 
 
-
-
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
COMPLETE_FONT_SYSTEMS_SUMMARY.md
COMPLETE_FONT_SYSTEMS_SUMMARY.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
FUNCTION_SUPPORT_SUMMARY.md
FUNCTION_SUPPORT_SUMMARY.md
 
 
LICENSE
LICENSE
 
 
LICENSE-COMMERCIAL
LICENSE-COMMERCIAL
 
 
Makefile
Makefile
 
 
PROJECT_STRUCTURE.md
PROJECT_STRUCTURE.md
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
SECURITY_TEST_REPORT.md
SECURITY_TEST_REPORT.md
 
 
SETUP.md
SETUP.md
 
 
ULTRA_COMPACT_FONT_SUMMARY.md
ULTRA_COMPACT_FONT_SUMMARY.md
 
 
USAGE.md
USAGE.md
 
 
advanced_14segment_printer.ggcode
advanced_14segment_printer.ggcode
 
 
arcade_font_system.ggcode
arcade_font_system.ggcode
 
 
compact_14segment_printer.ggcode
compact_14segment_printer.ggcode
 
 
compact_font_algorithms.ggcode
compact_font_algorithms.ggcode
 
 
corrected_text_printer.ggcode
corrected_text_printer.ggcode
 
 
debug_gcode_function.ggcode
debug_gcode_function.ggcode
 
 
function_text_printer.ggcode
function_text_printer.ggcode
 
 
logo.png
logo.png
 
 
minimal_compact_font.ggcode
minimal_compact_font.ggcode
 
 
numeric_text_printer.ggcode
numeric_text_printer.ggcode
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
simple_14segment_printer.ggcode
simple_14segment_printer.ggcode
 
 
simple_compact_font.ggcode
simple_compact_font.ggcode
 
 
simple_segment_font.ggcode
simple_segment_font.ggcode
 
 
test_simple_recursion.ggcode
test_simple_recursion.ggcode
 
 
true_segment_font.ggcode
true_segment_font.ggcode
 
 
ultra_compact_font.ggcode
ultra_compact_font.ggcode
 
 
working_segment_font.ggcode
working_segment_font.ggcode
 
 

Repository files navigation

GGcode Logo

GGcode

GGcode is a parametric G-code compiler that transforms static CNC programs into dynamic, programmable toolpaths. Write JavaScript-like code that generates professional G-code with variables, loops, functions, and math.

🌐 Try GGcode Online → - No installation required!

✨ Key Features

  • Interactive CLI - Smart file selection menu for easy compilation
  • Professional G-code Output - Industry-standard formatting with configurable precision
  • Full Programming Language - Variables, functions, loops, conditionals, and arrays
  • Built-in Math Library - Trigonometry, geometry functions, and constants
  • Cross-platform - Works on Linux, macOS, and Windows
  • Lightweight - Single binary, no dependencies

šŸŽÆ Quick Example

Instead of repetitive G-code:

G1 X10 Y0 F300
G1 X20 Y0 F300  
G1 X30 Y0 F300

Write parametric GGcode:

let feed = 300
for i = 1..3 {
    G1 X[i*10] Y0 F[feed]
}

Output:

N10 G1 X10.000 Y0.000 F300.000
N15  X20.000 Y0.000
N20  X30.000 Y0.000

šŸš€ Quick Start

Build & Install

# Install dependencies
sudo apt install build-essential gcc make  # Ubuntu/Debian
xcode-select --install                     # macOS

# Build with automatic global installation prompt
make

After building, you'll be prompted:

šŸŒ Install ggcode globally? (y/N): y
Choose installation method:
  1) Symlink to /usr/local/bin (recommended)
  2) Copy to /usr/local/bin  
  3) Add to PATH in ~/.bashrc

Build Options

Command Description
make Build + prompt for global install
make install Install globally (manual)
make uninstall Remove global installation
make test Run unit tests
make win Cross-compile for Windows
make clean Clean build files

ļæ½ļøU Interactive CLI

Default behavior: Run ggcode (if installed globally) or ./GGCODE/ggcode to get an interactive menu:

ā”ā”“ā”ā”“ā”ā”“ā”ā”“ā”³ā”“ā”ā”“  ā”ā”“       •┓      ā”ā”“ā”“ ┳
ā”ƒā”“ā”ƒā”“ā”ƒ ā”ƒā”ƒā”ƒā”ƒā”£   ā”ƒ ā”ā”“ā”ā”³ā”“ā”ā”“ā”“ā”ƒā”ā”“ā”ā”“  ā”ƒ ā”ƒ ā”ƒ
┗┛┗┛┗┛┗┛┻┛┗┛  ┗┛┗┛┛┗┗┣┛┗┗┗ ā”›   ┗┛┗┛┻   v1.1.2

Found 3 .ggcode files:

  1) part1.ggcode
  2) part2.ggcode  
  3) complex_pattern.ggcode
  4) Compile all files
  h) Show help
  0) Exit

Select option (0-4, h): 

Command Line Options

# Interactive menu (default) - use globally or locally
ggcode                       # If installed globally
./GGCODE/ggcode             # Local binary

# Compile specific files
ggcode part.ggcode
ggcode part1.ggcode part2.ggcode

# Compile all files
ggcode -a

# Custom output
ggcode -o custom.gcode part.ggcode
ggcode --output-dir ./build *.ggcode

# Direct evaluation (testing)
ggcode -e "G1 X10 Y20 F300"
ggcode -e "for i=1..5 { G1 X[i*10] Y0 }"

# Options
ggcode -q -a        # Quiet mode
ggcode --help       # Show help
ggcode --version    # Show version

šŸ“ Project Structure

GGcode/
ā”œā”€ā”€ src/                    # C source code
│   ā”œā”€ā”€ lexer/             # Tokenization
│   ā”œā”€ā”€ parser/            # Syntax parsing and AST
│   ā”œā”€ā”€ runtime/           # Expression evaluation
│   ā”œā”€ā”€ generator/         # G-code generation
│   ā”œā”€ā”€ cli/               # Command line interface
│   └── main.c             # Main entry point
ā”œā”€ā”€ tests/                  # Unit tests
ā”œā”€ā”€ GGCODE/                 # Compiled binaries
ā”œā”€ā”€ Makefile               # Build system
└── README.md              # Documentation

šŸ“ Language Reference

Variables & Arrays

let x = 10                    // Variables
let points = [1, 2, 3]        // 1D arrays
let grid = [[1,2], [3,4]]     // 2D arrays
G1 X[x] Y[points[0]]          // Variable interpolation

Control Flow

if x > 10 { G1 X[x] }         // Conditionals
for i = 1..5 { G1 X[i] }      // Loops
while x < 100 { x = x + 1 }   // While loops

function circle(radius) {      // Functions
    return PI * radius * radius
}

G-code Commands

G0 X[x] Y[y]                  // Rapid move
G1 X[x] Y[y] F[feed]          // Linear move
M3 S[speed]                   // Spindle on
note {Cut depth: [z]mm}       // Comments

Math & Constants

let angle = 45 * DEG_TO_RAD   // Constants: PI, E, TAU, DEG_TO_RAD
let dist = sqrt(x*x + y*y)    // Math: abs, sqrt, sin, cos, tan, etc.
let result = distance(x1, y1, x2, y2)  // Geometry functions

Formatting Control

let decimalpoint = 2          // Control decimal places (0-6)
let nline = 0                 // Disable line numbering

šŸŽØ Examples

Parametric Circle

function circle(radius, steps) {
    for i = 0..steps {
        let angle = i * (360 / steps) * DEG_TO_RAD
        let x = radius * cos(angle)
        let y = radius * sin(angle)
        G1 X[x] Y[y] F300
    }
}

circle(10, 36)  // 10mm radius, 36 steps

Conditional Machining

let material = 1  // 1=aluminum, 2=steel
let speed = material == 1 ? 8000 : 6000
let depth = material == 1 ? -2 : -1

M3 S[speed]
G1 Z[depth] F300

Array Processing

let holes = [[10,10], [20,10], [30,10]]
for i = 0..2 {
    G0 X[holes[i][0]] Y[holes[i][1]]
    G1 Z-5 F100
    G0 Z5
}

šŸ”§ Troubleshooting

Build Issues:

# Install dependencies
sudo apt install build-essential gcc make  # Ubuntu/Debian
brew install gcc make                      # macOS

# Fix permissions
chmod +x GGCODE/ggcode

Runtime Issues:

  • Verify variable names are defined before use
  • Check bracket matching { } and [ ]
  • Use note {} blocks for debugging
  • Run make test to verify installation

šŸ‘Øā€šŸ’» Author

T1 - Creator and Lead Developer

Contributing

  • Report issues on GitHub
  • Submit feature requests
  • Contribute example files
  • Help with documentation and translations

Support

  • 🌐 Online Demo - Try GGcode instantly
  • šŸ“§ Email: [email protected]

šŸ“œ License

This project is licensed under the MIT License for personal, educational, and small business use.

License Files:

  • LICENSE — Free use terms and conditions
  • LICENSE-COMMERCIAL — Commercial licensing information

Commercial Use: For commercial licensing inquiries, contact: [email protected]


About

parametric scripting language for generating G-code

gg.doorbase.io

Topics

cadcamcnccnc-programminggcode-generationmachine-controlparametric-designscripting-languagetoolpath

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

16 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.