ここはDQNEOのメモ用レポジトリです。
- Nginx
- PHP7
- H2O
- Emacs
- shell-popが使いにくいので古いバージョンに戻す
- php-modeが壊れたので入れなおす
- perl-modeがイマイチな気がするので何とかする
- emacs-clientをためす
- perl,phpなどのパスの通し方を調べる
- magitを使う
- shell環境
- z (zaw)の使い方を調べる
- git
- git logを改善する
- Docker
- docker-perlのレポジトリを統合する
babygo👶 is a small Go compiler made from scratch, which can compile itself. It's going to be the smallest and simplest go compiler in the world.
License: MIT License
ここはDQNEOのメモ用レポジトリです。
I want them to be initialized in a function at runtime in compiler source.
var a uint8 = 'a'
var b uint8 = 'b'
var c uint8 = 'c'
d := receiveBytes(a, b, c)
0x001d 00029 (sample.go:14) MOVB $97, "".a+23(SP)
0x0022 00034 (sample.go:15) MOVB $98, "".b+22(SP)
0x0027 00039 (sample.go:16) MOVB $99, "".c+21(SP)
0x002c 00044 (sample.go:17) MOVBLZX "".a+23(SP), AX
0x0031 00049 (sample.go:17) MOVB AL, (SP)
0x0034 00052 (sample.go:17) MOVBLZX "".b+22(SP), AX
0x0039 00057 (sample.go:17) MOVB AL, 1(SP)
0x003d 00061 (sample.go:17) MOVB $99, 2(SP)
0x0042 00066 (sample.go:17) PCDATA $1, $0
0x0042 00066 (sample.go:17) CALL "".receiveBytes(SB)
0x0047 00071 (sample.go:17) MOVBLZX 8(SP), AX
0x004c 00076 (sample.go:17) MOVB AL, "".d+20(SP)
var fn = myFunc
fn()
package main
import "reflect"
import "fmt"
type MyType struct {
id int
}
func main() {
fmt.Printf("%s\n", reflect.TypeOf(&MyType{}).String())
}
*main.MyType
Want to do this
type Type = ast.Type
Showing ioc at runtime panic will be super helpful.
https://sourceware.org/binutils/docs/as/Loc.html#Loc
needed for #74
Currently, array of which length is more than 9 cannot be compiled.
type MyInt int
type MyMyInt MyInt
type ForeignInt another.MyInt
Same as the official go
func multiVars(a uint8, b uint8, c uint8) (uint8, uint8, uint8) {
return a, b, c
}
"".multiVars STEXT nosplit size=43 args=0x10 locals=0x0
0x0000 00000 (sample/sample.go:5) TEXT "".multiVars(SB), NOSPLIT|ABIInternal, $0-16
0x0000 00000 (sample/sample.go:5) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (sample/sample.go:5) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (sample/sample.go:5) MOVB $0, "".~r3+16(SP)
0x0005 00005 (sample/sample.go:5) MOVB $0, "".~r4+17(SP)
0x000a 00010 (sample/sample.go:5) MOVB $0, "".~r5+18(SP)
0x000f 00015 (sample/sample.go:6) MOVBLZX "".a+8(SP), AX
0x0014 00020 (sample/sample.go:6) MOVB AL, "".~r3+16(SP)
0x0018 00024 (sample/sample.go:6) MOVBLZX "".b+9(SP), AX
0x001d 00029 (sample/sample.go:6) MOVB AL, "".~r4+17(SP)
0x0021 00033 (sample/sample.go:6) MOVBLZX "".c+10(SP), AX
0x0026 00038 (sample/sample.go:6) MOVB AL, "".~r5+18(SP)
0x002a 00042 (sample/sample.go:6) RET
0x0000 c6 44 24 10 00 c6 44 24 11 00 c6 44 24 12 00 0f .D$...D$...D$...
0x0010 b6 44 24 08 88 44 24 10 0f b6 44 24 09 88 44 24 .D$..D$...D$..D$
0x0020 11 0f b6 44 24 0a 88 44 24 12 c3 ...D$..D$..
go run
should be run on macOSas in ioutil.ReadFile()
Currently in some cases slice == nil
gives false even if slice is nil.
when slice is nil,
expression | value |
---|---|
slice == nil | true |
nil == slice | true |
slice =! nil | false |
nil != slice | false |
when slice is non-nil,
expression | value |
---|---|
slice == nil | false |
nil == slice | false |
slice =! nil | true |
nil != slice | true |
%v, %#v, %T, %p
i clone the project, compile it locally use go build -o babygo main.go
, and the compiler output:
local machine go env:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dingwenjiang/Library/Caches/go-build"
GOENV="/Users/dingwenjiang/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="*.byted.org,*.everphoto.cn,git.smartisan.com"
GONOSUMDB="*.byted.org,*.everphoto.cn,git.smartisan.com"
GOOS="darwin"
GOPATH="/Users/dingwenjiang/go"
GOPRIVATE="*.byted.org,*.everphoto.cn,git.smartisan.com"
GOPROXY="https://goproxy.byted.org,https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b1/c9m_f9ds2d15433dvj3b24n00000gp/T/go-build018035766=/tmp/go-build -gno-record-gcc-switches -fno-common"
Consider these cases
str := string(slice)
slice[0] = 'X'
str := "hello"
slice := []byte(str)
slice[0] = 'X'
for readFile()
Blocking #2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.