GithubHelp home page GithubHelp logo

wmww / pinecone Goto Github PK

View Code? Open in Web Editor NEW
863.0 52.0 116.0 3.74 MB

An unmaintained programming language

Home Page: http://pinecone-lang.herokuapp.com/

License: MIT License

C++ 99.62% Makefile 0.09% C 0.10% Shell 0.18%
programming-language language pinecone

pinecone's Introduction

The Pinecone Programming Language

Built from the ground up to be fast, concise and intuitive.

NOTE: PINECONE IS NO LONGER BEING ACTIVELY DEVELOPED OR MAINTAINED

Pinecone is a new programming language. Its goal is to combine the simplicity of a dynamic language with the performance of a compiled one. It is under rapid development, but most of the core features are ready.

If you want to program in Pinecone now, see the tutorials for how to get started.

There is also a Pinecone plugin for VIM here.

For updates, discussion and help, take a look at the Pinecone subreddit: /r/PineconeLang

About

Pinecone is a brand new, easy to learn, general purpose, multi-paradigm, high performance programming language created by Sophie Winter. Work on the language began on October 4th, 2016. Pinecone can now be interpreted or transpiled to C++. The language is written from scratch (it includes an integrated lexer, parser and interpreter, etc.).

Example

Here is the common demo program FizzBuzz written in Pinecone. It prints the numbers from 1 to 20, but it prints "Fizz" if the number is divisible by 3, "Buzz" if it is divisable by 5 and "FizzBuzz" if it is divisible by both. You can find more samples in the examples directory or the tutorials.

# FizzBuzz

# call the function defined below
fizzBuzz: 1, 20

# define the FizzBuzz function
fizzBuzz :: {start: Int, end: Int}: (

	# loop i from start to end
	i: in.start | i <= in.end | i: i+1 @ (

		# use conditionals to print the right thing

		i % 3 = 0 && i % 5 = 0 ?
			print: "FizzBuzz"
		|
		i % 3 = 0 ?
			print: "Fizz"
		|
		i % 5 = 0 ?
			print: "Buzz"
		|
			print: i
	)
)

Why?

This is probably the most common reaction to hearing about a new language. I realize that there are a lot of programming languages, and that the reason for that is that there are so many assholes like me who keep making them. I do truly think, though, that Pinecone fills a previously empty niche.

Pinecone aims to have similar capabilities to modern object oriented compiled languages such as C++, Swift and Rust. It's primary attraction is the simplicity and consistency of it's syntax. Here are some examples of how Pinecone is different from other popular languages:

  • Variable creation is implicit, just set a variable and it is created.
  • Variables are statically typed, but type deduction is automatic.
  • Calling a function that takes no arguments is the same syntax as accessing a variable (just writing it's name).
  • Calling a function that takes one argument is the same syntax as setting or creating a variable (funcOrVar: input).
  • Calling a function that takes multiple arguments is the same syntax as setting or creating a tuple (funcOrTuple: input1, input2).
  • White space is ignored and semicolons are not necessary
  • : is used for assignment, which leaves = free for comparison, rather than the often confusing ==.
  • Tuples, structs and classes are all basically the same thing
  • Functions can be sent arguments from the left side, right side or both (inputLeft.function: inputRight), which is used for class methods but can also allow you to define functions for any type (even primitive).
  • Program control is done with operators instead of keywords (? instead of if)

Compatibility

Pinecone currently requires zero external dependencies (and the only one that will likely be added is LLVM). You will need a C++11 compiler to build it, and the process is easier with GCC and Make. Pinecone has been successfully tested on Linux, MacOS and Windows.

Current State

The features that are currently implemented are as follows:

  • Primitive data types Bool, Int and Dub
  • All the operators you would expect (+, *, %, :, =, >, <=, &&, etc.)
  • Single and multi line comments
  • Flow control (if, if/else, while loop, for loop)
  • Constants
  • Data structs
  • Tuples
  • Int arrays
  • Functions
  • Strings and various String operations
  • User input
  • Running system commands
  • Interpreter for rapid development and simplicity
  • Transpiler to C++ for max performance

The following features are coming soon:

  • Whatev type (equivalent to templates or generics in other languages)
  • Arrays of any type (Whatev support needed)
  • Pass-by-reference
  • Proper classes (pass-by-reference needed)
  • Operator overloading

Contributing

I have not yet added enough documentation to the language internals to make it practical for others to contribute to the language itself. If you are interested in adding a specific feature or just helping out, post in the subreddit or direct message me on reddit or twitter. Fixes and improvements to the readmes and tutorials are always welcome.

pinecone's People

Contributors

ashish-auroraar avatar joydeepsaha05 avatar laaas avatar pudility avatar ron-wolf avatar trosel avatar wmww avatar ws-kj avatar zoecarver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinecone's Issues

What does the name Pinecone mean?

Hi there,

I know this project is abandoned, but I'm intrigued about the name. Why Pinecone? What is its meaning/significance for this language?

Thanks!

Casting ActionData to long int error with GCC

Hi just tried to compile pinecone and i got this error with GCC (5.1).
src/Actions/FunctionAction.cpp:104:31: error: cast from 'ActionData*' to 'long int' loses precision [-fpermissive] name+="_"+to_string((long)&*action); ^
Thanks.

Windows style line endings not supported

i have compiled pinecone with the make file and i got this error for every file i test.

$ ./pinecone ./examples/hello_world.pn
error in './examples/hello_world.pn' on line 1:
'   invalid token '
    print: "Hello World!"
                         ^
error in './examples/hello_world.pn' on line 2:
'   invalid token '

    ^
program not executed due to errors

I'm running on WSL Ubuntu 16.04 64-bit

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial
$ uname -a
Linux DESKTOP-53JBK0N 4.4.0-17134-Microsoft #1-Microsoft Tue Apr 10 18:04:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

image

Interpreter Source code

I saw your blog post which I loved, I am also trying to create my PL in python/js, I have seen your lexer and parser source code, but where is the interpreters own.

Hi

I saw your code and I want to ask u))) Where u learnt C++?

Contributor

Hi, I will like to contribute to Pinecode. Even though I am a beginner in creating a language, I can help. Please provide enough documentation to the language internals to make it practical for me to contribute @wmww

.

.

illegal hardware instruction on macos 10.15.3

When I finished compiling the compiler,and wanted to run it,it gave me a SIGILL like this:

Hello World!
zsh: illegal hardware instruction ./pinecone examples/hello_world.pn

Why does it happen?

{Bug} Make command not found

I typed in make and it said not found then I tried again after installing make via 'pip install make' and it still didn't work.

Repository Description Typo

Current Description is

A brand new, easy to learn, general purpose, multi-paradigm, high performence programming language

This should be spelled performance. If you were aware or did it on purpose, I apologize but figured I should let you know.

Hello

Pinecone is greate language, but can u make an ex. .bat: pinecone filename and it will run, I can help

make command not found

I typed in make and it said not found then I tried again after installing make via 'pip install make' and it still didn't work.

I have an idea.

microbit is a project by the BBC, which I think is very cool. I want to make a pinecone interface for the microbit. It would turn the code into a .hex file, the that would then be saved as a file on the computer.

contribute

hi
i'm working on Pace Runtime (Pacer), which runs Pace Assembly on a virtual machine.
I've created the assembly language and virtual machine and now i'm working on perfomance and bug fixing, And then wanna write a compiler that turns a C-like prgoram to this assembly, but I need help.
I don't know how to get start to write a compiler. can you help me?
this a hello world program in my assembly:

%define assembly_title "Hello"
... ; some definations for assembly manifest
%include "Pacer.inc" ;include Pacer OpCodes

pace_binary_table:
   dep "PSTDLib", "", 0, 1 ; depends on PSTDLib from any author higher than version 0.1
   fun "main", _hmain, _hmain_end - _hmain ;name, offset, size
   var 0x00000000 ;defines a variable with id 0x00000000
pace_binary_table_close

_hmain EQU $
   _read t_string, "Hello, ", 0 ;read a null-terminated string
   _push
   _read t_string, "World!", 0
   _push
   _add ;adds two last objects in stack togother
   _save 0 ;var 0x0000000 = "Hello, " + "World!"
   _load 0  ;read from a variable
   _push
   _calle 0, "println" println(var 0x000000)
   _newobj t_void
   _ret ;return void
_hmain_end EQU $

it assembles with nasm, and output runs on top of my PRT (Pace Runtime).
if i implement this in the C-like language, may lok like this:

#name "hello"
...
#include "PSTDLib"
extern 0, println(1) // println from 0st include with 1 argument(s)
var x; // Pacer has Run-Time Typing for variables
main(0) {
   x = "Hello, " + "World!";
   println(x);
   return void;
}

I'll release a beta version with sources on github soon.
can you target my runtime with your Pinecone?

I can do some maintenance

I think Pinecone looks like an interesting language. If I fork it, would you be willing to put a link to my fork in the README?

possible Typo in ErrorHandler.cpp

On line 30 of src/ErrorHandler.cpp there's statement that looks like this:
case INTERNAL_ERROR: return "INTERNAL ERRER"; break;

Shouldn't this return "INTERNAL ERROR"?

Add Windows support

Hi,

two small issues on Windows with gcc (gcc version 6.3.0 (GCC)). Both report missing headers which are typically not found on windows. I haven't looked at the implementation but I guess it is possible to work around these kind of issues. Not sure if you want support windows as platform at all.

First one - msys2 (bash environment)

[ome/src/github/Pinecone]>make
g++ -Wall -std=c++11 -O2 src/.cpp src/Actions/.cpp -o pinecone
src/msclStringFuncs.cpp:8:21: fatal error: termcap.h: No such file or directory

                 ^

compilation terminated.
make: *** [Makefile:6: build] Error 1

Second one Mingw and Windows console

c:\home\src\github\Pinecone>make
g++ -Wall -std=c++11 -O2 src/.cpp src/Actions/.cpp -o pinecone
src/msclStringFuncs.cpp:5:54: fatal error: sys/ioctl.h: No such file or directory
#include <sys/ioctl.h> // for terminal size detection
^
compilation terminated.
src/Actions/FunctionAction.cpp: In member function 'virtual void FunctionAction::addToProg(Action, Action, CppProgram*)'
:
src/Actions/FunctionAction.cpp:100:36: error: cast from 'ActionData*' to 'long int' loses precision [-fpermissive]
name="^func_"+to_string((long)&*action);
^~~~~~
make: *** [Makefile:6: build] Error 1

Help.

How does one make a class? Using data structures like:

myClass :: {
   name: ""
   myFunc :: {} -> {String} : (
      print: "Hi, " + name
   )

Or by using left input?

myClass: ""
myFunc :: {myClass}.{} -> {String} : (
   print: "Hi, " + name
)

Probably a big ask: linking with C/C++ libraries

Pinecone does not currently support linking with C/C++ libraries. One example is ncurses, which provides screen manipulation support. If we could use that, we could rewrite snake yet again, adding yet more โญgameplay featuresโญ.

I understand that this is a very complicated feature in an interpreted language (heck, Python hasn't got it fully figured out), but it would be very nice not to have to constantly re-invent the wheel. :)

This isn't an issue but...

@william01110111 I am a C# developer (and I love this programming language). I have started developing Pinecone in C# for Windows compatibility (and you currently don't have this), with a compiler... so if I could have some sort of specification document I will happily finish it and create a pull request with the needed subfolders, code and executables (yes, so you can do stuff like C:\> pinecone myprogram.pn)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.