Skip to content

Getting Started

Pt edited this page Jun 17, 2026 · 2 revisions

This guide is aimed at integrating Lc into real systems quickly and safely.

Requirements

  • Go 1.24+

Install

go get github.com/pt-main/lc

Step 1 - Choose engine mode

  • lc.StringEngineType for text-driven execution.
  • lc.ByteEngineType for binary/opcode-driven execution.

Step 2 - Bootstrap a minimal runtime

String Engine

package main

import (
	"github.com/pt-main/lc"
	"github.com/pt-main/lc/stringParsing"
)

func main() {
	parser := &stringParsing.Parser2{}
	_, _ = lc.NewEngineBuilder(lc.StringEngineType).
		WithPipeline([]string{"main"}).
		WithStringParser(parser).
		WithDefaultEvents(true).
		Build()
}

Byte Engine

package main

import (
	"github.com/pt-main/lc"
	"github.com/pt-main/lc/byteParsing"
	"github.com/pt-main/lc/tooling/bytecode"
)

func main() {
	parser := &byteParsing.Parser1{
		Config: byteParsing.Parser1Config{
			GConfig: bytecode.GenerationConfig{
				CommandBytelen:   1,
				ArgscountBytelen: 1,
				ArglenBytelen:    1,
				Endianess:        bytecode.LittleEndian,
			},
			Shifter: bytecode.Shift{},
		},
	}
	_, _ = lc.NewEngineBuilder(lc.ByteEngineType).
		WithPipeline([]string{"main"}).
		WithByteParser(parser).
		WithDefaultEvents(true).
		Build()
}

Step 3 - Production baseline

Recommended defaults for industrial usage:

  • explicit multi-stage pipeline,
  • service-level context propagation,
  • explicit logger injection,
  • controlled scope schema,
  • event hooks for metrics/audit.

Clone this wiki locally