Skip to content

Commit

Permalink
Introduce llgoi, a REPL for Go
Browse files Browse the repository at this point in the history
llgoi is a Go REPL based on llgo irgen and the LLVM JIT. It supports
expressions, statements, most declarations and imports, including binary
imports from the standard library and source imports from $GOPATH.

Differential Revision: http://reviews.llvm.org/D6957

llvm-svn: 226097
  • Loading branch information
pcc committed Jan 15, 2015
1 parent b6a5d05 commit 6725a83
Show file tree
Hide file tree
Showing 15 changed files with 701 additions and 7 deletions.
22 changes: 16 additions & 6 deletions llgo/CMakeLists.txt
Expand Up @@ -39,12 +39,6 @@ llvm_add_go_executable(llgo llvm.org/llgo/cmd/gllgo ALL DEPENDS
ssaopt/esc.go
)

install(FILES ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX}
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)

llvm_add_go_executable(llgo-stage2 llvm.org/llgo/cmd/gllgo
DEPENDS libgo ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX}
GOFLAGS "cc=${CMAKE_BINARY_DIR}/bin/clang"
Expand All @@ -63,6 +57,22 @@ llvm_add_go_executable(cc-wrapper llvm.org/llgo/cmd/cc-wrapper DEPENDS
cmd/cc-wrapper/main.go
)

llvm_add_go_executable(llgoi llvm.org/llgo/cmd/llgoi
DEPENDS libgo ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX}
cmd/llgoi/isatty_posix.go
cmd/llgoi/llgoi.go
GOFLAGS "cc=${CMAKE_BINARY_DIR}/bin/clang"
"cxx=${CMAKE_BINARY_DIR}/bin/clang++"
"llgo=${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX}"
)

install(FILES ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_BINARY_DIR}/bin/llgoi${CMAKE_EXECUTABLE_SUFFIX}
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)

function(add_clobber_steps name)
ExternalProject_Add_Step(${name} force-reconfigure
DEPENDERS configure
Expand Down
29 changes: 29 additions & 0 deletions llgo/cmd/llgoi/isatty_posix.go
@@ -0,0 +1,29 @@
//===- isatty_posix.go - isatty implementation for POSIX ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Implements isatty for POSIX systems.
//
//===----------------------------------------------------------------------===//

package main

// +build !windows

/*
#include <unistd.h>
*/
import "C"

import (
"os"
)

func isatty(file *os.File) bool {
return C.isatty(C.int(file.Fd())) != 0
}

0 comments on commit 6725a83

Please sign in to comment.