Skip to content

ballerina-platform/ballerina-lang-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

461 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ballerina-lang-go

codecov

Goals

The primary goal of this effort is to come up with a native Ballerina compiler frontend that is fast, memory-efficient and has a fast startup. Eventually it could replace the current jBallerina compiler frontend.

Implementation plan

The implementation strategy involves a one-to-one mapping of the jBallerina compiler.

Usage

Dependencies

The project is built using the Go programming language. The following dependencies are required:

Build the CLI

Production Build (default)

go build -o bal ./cli/cmd

Debug Build

go build -tags debug -o bal-debug ./cli/cmd

Using Profiling

Profiling is only available in debug builds (compiled with -tags debug).

Enable Profiling

# Default profiling port (:6060)
./bal-debug run --prof corpus/bal/subset1/01-boolean/equal1-v.bal

# Custom port
./bal-debug run --prof --prof-addr=:8080 corpus/bal/subset1/01-boolean/equal1-v.bal

Access Profiling Data

Analyze with pprof Tool

# CPU profiling (30 second sample)
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30

# Heap profiling
go tool pprof http://localhost:6060/debug/pprof/heap

# Interactive web UI
go tool pprof -http=:8081 http://localhost:6060/debug/pprof/profile?seconds=30

Using the CLI

CLI Help

./bal --help
./bal run --help

Running a bal source

Currently, the following are supported:

  • Single .bal file
  • Ballerina package with only the default module

E.g

./bal run --dump-bir corpus/bal/subset1/01-boolean/equal1-v.bal
./bal run project-api-test/testdata/myproject

Testing

To run the tests, use the following command:

go test ./...

About

The Ballerina Compiler in Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

Languages