Bpp

command module
v0.0.0-...-e689c96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 18 Imported by: 0

README

B++

Go Reference Go Report Card

A B++ parser, interpreter, and compiler written in Go! Check the docs for more information on the B++ language and how it works, and the programming guide on how to import and use this library, with your code!

Installation

To install or update B++, do

go get -u github.com/Nv7-Github/Bpp

Usage

To run a file, do

bpp run <filename>

For example, to run the kin example, do

bpp run examples/kin.bpp

B++ programs support arguments. To pass arguments, use --args with comma-seperated values. For example:

bpp run --args arg1,arg2,arg3 <filename>

You can time how long it takes to run a B++ program, using --time or -t. For example:

bpp run -t <filename>

Converting Go Programs

It can be hard to write B++ code, so you can convert Go code to B++! Lets say you have a file called factorial.go:

package main

func factorial(num int) int {
  result := 1
  if num >= 1 {
    result = factorial(num - 1) * num
  }
  return result
}

func main() {
  print(factorial(10))
}

Well, you can just do

bpp convert factorial.go

To convert it to B++ code, saved in the file factorial.bpp!

You can also use the -o parameter to specify the output file, like:

bpp convert factorial.go -o coolprogram.bpp

To save the B++ code to a file called coolprogram.bpp!

Compiling Programs

Bpp also supports compiling B++ programs into a native, extremely high-performance executable! You can use --time or -t with this too.

⚠ Arrays are not supported!

To compile a program, just do

bpp build <filename>

You can also use -o or --output to specify the output file. For example, to compile the kin example, do:

bpp build -o kin examples/kin.bpp

This will produce LLVM IR. To convert it into an executable, use an LLVM compiler, like

bpp build <filename> -cc clang

Multiple Files

For both build and run, you can pass multiple files. These can be used with an IMPORT statement. To pass multiple files, do

bpp run main.bpp file1.bpp file2.bpp

You can also use directories, like:

bpp build .

⚠ If you are using more than one file, there must be a file called main.bpp, which will be run.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package compiler compiles a B++ AST tree into LLVM IR, which can then be compiled into extremely high-performance Assembly.
Package compiler compiles a B++ AST tree into LLVM IR, which can then be compiled into extremely high-performance Assembly.
Package gobpp converts Go source code into B++ source code.
Package gobpp converts Go source code into B++ source code.
Package membuild converts a B++ AST tree into a series of lambdas which can then be executed.
Package membuild converts a B++ AST tree into a series of lambdas which can then be executed.
Package parser parses B++ source code into an AST tree.
Package parser parses B++ source code into an AST tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL