An LL(1) parser generator for the Go programming language.

What is it?

I have implemented an LL(1) parser generator for the Go programming language. I did this to build parse trees for my HAML parser.
You can find out more about LL(1) parsers at LL Parser (Wikipedia)
You can find out more about GO at golang.org

Check out the wiki for information on the input grammar, the generated file structure, and other stufff (but not much other stuff).

This branch compiles with 6g/8g version release.r60 9481.

Is it done?

For a first draft, yes, I think so. Features include:

  • Yacc-like input grammar files
    • Ad-Hoc Syntax Directed Translations
    • Custom type handling with yystype, %token-, and %type declarations
  • “Dev” mode to emit printing instructions for the generated parser
  • Package setting
  • Sample input.y file with the expected command-line calculator grammar with operator precedence

How can I install this?

Just follow the simple directions from the command line.

goinstall "github.com/realistschuckle/goll1e"
pushd $GOROOT/src/pkg/github.com/realistschuckle/goll1e/
make install
popd

HEY! This doesn’t build! What’s wrong with you?

Ok, the release and master branches contain code that compiles against the latest documented release of Go. Sometimes, those
awesome and crazy Go guys change the cr4p out of the API and that breaks goll1e. Try switching over to the preview branch
and compiling that one. I try to keep it up to date with breaking changes to Go.

Thanks. That was fun. How can I uninstall this?

Just follow the simple directions from the command line:

pushd $GOROOT/src/pkg/github.com/realistschuckle/goll1e/
make nuke
popd
rm -rf $GOROOT/src/pkg/github.com/realistschuckle/goll1e/

How can I test this out?

Just follow the simple directions from the command line:

git clone git://github.com/realistschuckle/goll1e.git goll1e
cd goll1e
make gen
test/test
1 * 2 + 3 / 4 - 5 eof

How can I use it?

Create a grammar file, run goll1e against it, and include that .go file in your project. The command syntax goes something like goll1e input.y output.go. Then, call the yyparse(int, func(*yystype)int)bool function. It’ll return true if the parse succeeded and the result of your computations will exist in yyres[0]. Otherwise, you’ll get a false and junk will populate yyres.

Can I type to goll1e on stdin?

Yep. And, it’ll print to standard out, too. Just type goll1e at the command prompt after installation and you can type all you want with a CTRL+D to signal EOF.

Owner
Curtis Schlak
I have a job. This is my not-job face. @hr-curtissimo is my job face. My old job faces: @aA-curtissimo & @tiy-curtissimo. My not-job job face is @curtissimo.
Curtis Schlak
Similar Resources

Simple, safe and compiled programming language.

The X Programming Language Simple, safe and compiled programming language. Table of Contents Overview OS Support Contributing License Overview The X p

Dec 28, 2022

A interpreter of SweetLang, is writed in Go Programming language.

SweetLang ( Soon ) A interpreter of SweetLang, is writed in Go Programming language. SweetLang is made with clarity and simplicity we try to make its

Oct 31, 2021

Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey Monkey programming language 🐒 project from "Writing An Interpreter In Go

Dec 16, 2021

ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022

ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022

WindLang, A simple programming language built with golang 🍃

WindLang, A simple programming language built with golang 🍃

WindLang, A simple programming language built with golang 🍃 WindLang, A simple programming language built with golang 🍃 What is wind? Playground Coo

Dec 1, 2022

A basic Forth parser written in Go.

GoForth ======= I got really interested in Forth and thus I began making a parser, of sorts, in Go. Though I don't intend for it to catch on, it's st

Mar 1, 2022

A shell parser, formatter, and interpreter with bash support; includes shfmt

sh A shell parser, formatter, and interpreter. Supports POSIX Shell, Bash, and mksh. Requires Go 1.14 or later. Quick start To parse shell scripts, in

Jan 8, 2023

A multi-pass compiler written in Go comprised of scanner, recursive-descent parser, generation of AST, intermediate representation (ILOC), and code generation (Armv8).

GoLite Project - Go Huskies! This is a project conducted and led in the course MPCS 51300 Compilers at the University of Chicago. In a group of two, w

Jan 10, 2022
Floppa programming language inspired by the brainf*ck programming language. Created just for fun and you can convert your brainf*ck code to floppa code.

Floppa Programming Language Created just for fun. But if you want to contribute, why not? Floppa p.l. inspired by the brainf*ck programming language.

Oct 20, 2022
T# Programming Language. Something like Porth, Forth but written in Go. Stack-oriented programming language.

The T# Programming Language WARNING! THIS LANGUAGE IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Something like Forth a

Jun 29, 2022
Yayx programming language is begginer friendly programming language.
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

Dec 27, 2021
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

May 20, 2022
a dynamically typed, garbage collected, embeddable programming language built with Go

The agora programming language Agora is a dynamically typed, garbage collected, embeddable programming language. It is built with the Go programming l

Dec 30, 2022
Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).

Gentee script programming language Gentee is a free open source script programming language. The Gentee programming language is designed to create scr

Dec 15, 2022
PHP bindings for the Go programming language (Golang)

PHP bindings for Go This package implements support for executing PHP scripts, exporting Go variables for use in PHP contexts, attaching Go method rec

Dec 27, 2022
The Slick programming language is an s-expression surface syntax for Go.

The Slick programming language The Slick programming language is a Lisp/Scheme-style s-expression surface syntax for the Go programming language, with

Jan 8, 2023
Pineapple Lang is a simple programming language demo implements by Go

Pineapple Lang is a simple programming language demo implements by Go. It includes a hand-written recursive descent parser and a simple interpreter, although the language is not even Turing-complete. But this repo's main goal is to give beginners of compilation principles a warm up and a simple look at how a programming language is built.

Dec 26, 2022
⛳ A minimal programming language inspired by Ink, JavaScript, and Python.

⛳ Golfcart My blog post: Creating the Golfcart Programming Language Getting Started Scope Rules Usage Building and tests Contributions License Golfcar

Sep 6, 2022