Pineapple Lang is a simple programming language demo implements by Go

Overview

PINEAPPLE

(English | 中文)

Description

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.

How to run

$cd examples/pineapple/
$go build
$ ./pineapple hello-world.pineapple
pen pineapple apple pen.

May be other Language?

Don't worry, we have other pineapple-lang implements for you:

Tutorial

Contributors

License

You might also like...
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

⛳ 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

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

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

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

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

Interpreter - The Official Interpreter for the Infant Lang written in Go

Infant Lang Interpreter Infant Lang Minimalistic Less Esoteric Programming Langu

A dialect of Lisp extended to support concurrent programming, written in Go.

LispEx A dialect of Lisp extended to support concurrent programming. Overview LispEx is another Lisp Interpreter implemented with Go. The syntax, sema

Golem is a general purpose, interpreted scripting language.
Golem is a general purpose, interpreted scripting language.

The Golem Programming Language Golem is a general purpose, interpreted scripting language, that brings together ideas from many other languages, inclu

Comments
  • Could you provide a cpp implementation?

    Could you provide a cpp implementation?

    C/C++ is used by a lot of people. So I thought that cpp implementation is convenient for more people to learn. Now I am trying to implement it, but I meet some trouble. So u or someone else could provide a cpp implementation?

    opened by uran0sH 4
  • Behavior and EBNF mismatch regarding `Ignored`

    Behavior and EBNF mismatch regarding `Ignored`

    e.g. The following pineapple source code should raise lexer error (notice the whitespace between $ and a), but still passed:

    $ a = "pen pineapple apple pen."
    print($a)
    

    More generally speaking, Ignored in EBNF does not appear between every pair of other tokens, so should not be skipped in lexer whenever seen. Instead, it's better to treat Ignored as an individual token so that it can be correctly parsed.

    opened by KevinXuxuxu 2
  • 你好,请问parseStatement是否少了对TOKEN_IGNORED的处理

    你好,请问parseStatement是否少了对TOKEN_IGNORED的处理

    感谢你的教程,请教一个问题,parseStatement是否少了对TOKEN_IGNORED的处理,源码文本一开始就有一些可忽略的字符串的话,可能就需要处理一下? 谢谢,还是我哪里理解错了?

    func parseStatement(lexer *Lexer) (Statement, error) {
    	// LookAhead() 没有参数, 但执行它的时候, 他会 LookAhead (向前看) 一个 Token, 告诉我们下一个 Token 是什么.
    	switch lexer.LookAhead() {
    	case TOKEN_PRINT:
    		return parsePrint(lexer) // 如果是 TOKEN_PRINT ("print"), 那么肯定就是 Print 语句了! 我们就调用 parsePrint().
    	case TOKEN_VAR_PREFIX:
    		return parseAssignment(lexer)
    	//case TOKEN_IGNORED:  // 这里好像需要处理 TOKEN_IGNORED
    	//    lexer.nextTokenLineNum = 0   nextTokenLineNum  具体代表什么含义呢?
    	//	return nil, nil 
    	default:
    		return nil, errors.New("parseStatement(): unknown Statement.")
    	}
    }
    
    opened by yiippee 1
Releases(1.0.0)
Owner
karminski-牙医
karminski-牙医
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

T# 92 Jun 29, 2022
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

null 1 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

Yayx Programming Language 7 May 20, 2022
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

The X Programming Language 51 Dec 28, 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 ?? What is wind? Playground Coo

null 11 Dec 1, 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

Martin Angers 324 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

Alexey Krivonogov 101 Dec 15, 2022
Port of the lemon parser generator to the Go programming language

From the golang-nuts mailing list (with few modifications): --== intro ==-- Hi. I just want to announce a simple port of the lemon parser generator

null 54 Feb 17, 2022
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

Curtis Schlak 14 Jan 18, 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

Alex Palaistras 883 Dec 27, 2022