Skip to content

Commit

Permalink
wip(builder): fix compile errs after moving to building the whole thi…
Browse files Browse the repository at this point in the history
…ng (multi-module builds)
  • Loading branch information
emil14 committed Nov 3, 2023
1 parent 78af4d0 commit 946976f
Show file tree
Hide file tree
Showing 10 changed files with 361 additions and 124 deletions.
20 changes: 18 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Issues must only be created for known bugs and understandable architecture issue

## VSCode Extension

Check out [tygo.yaml](./tygo.yaml). It depends on types defined in the `src` and `ts` packages and thus it's dangerous to rename those types. If you gonna do so make sure you don't brake TS types generation.
Check out [tygo.yaml](./tygo.yaml). It depends on types defined in the `src` and `typesystem` packages and thus it's dangerous to rename those types. If you gonna do so make sure you don't brake TS types generation. Check [web/CONTRIBUTING.md](./web/CONTRIBUTING.md).

# Naming conventions

Expand All @@ -49,8 +49,11 @@ Use `_` instead of space in for test-case names because go turns spaces into und

## FBP/DataFlow

- [Flow-Based Programming: A New Approach to Application Development](https://jpaulmorrison.com/fbp/1stedchaps.html)
- [Elements of Dataflow and Reactive Programming Systems](https://youtu.be/iFlT93wakVo?feature=shared)
- [The origins of Flow Based Programming with J Paul Morrison](https://youtu.be/up2yhNTsaDs?feature=shared)
- [Dataflow and Reactive Programming Systems: A Practical Guide](https://www.amazon.com/Dataflow-Reactive-Programming-Systems-Practical/dp/1497422442)
- [Flow-Based Programming: A New Approach to Application Development](https://jpaulmorrison.com/fbp/1stedchaps.html)
- [Samuel Smith - "Flow Based Programming"](https://youtu.be/j3cP8uwf5YM?feature=shared)

## Golang

Expand Down Expand Up @@ -92,6 +95,7 @@ Use `_` instead of space in for test-case names because go turns spaces into und
- [Syntax Highlighter](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)
- [LSP Overview](https://microsoft.github.io/language-server-protocol/)
- [Go library for LSP implementation](https://github.com/tliron/glsp)
- [LSP official docs](https://microsoft.github.io/language-server-protocol/)

## Subjective Recommendations

Expand All @@ -102,6 +106,8 @@ Use `_` instead of space in for test-case names because go turns spaces into und
- ["Propositions as Types" by Philip Wadler](https://youtu.be/IOiZatlZtGU?feature=shared)
- ["Outperforming Imperative with Pure Functional Languages" by Richard Feldman](https://youtu.be/vzfy4EKwG_Y?feature=shared)
- ["What Is a Strange Loop and What is it Like To Be One?" by Douglas Hofstadter (2013)](https://youtu.be/UT5CxsyKwxg?feature=shared)
- ["The Economics of Programming Languages" by Evan Czaplicki (Strange Loop 2023)](https://youtu.be/XZ3w_jec1v8?feature=shared)
- [Why Isn't Functional Programming the Norm? – Richard Feldman](https://youtu.be/QyJZzq0v7Z4?feature=shared)

### Books And Articles

Expand All @@ -111,6 +117,16 @@ Use `_` instead of space in for test-case names because go turns spaces into und
- [Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems](https://www.amazon.com/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321)
- [Code: The Hidden Language of Computer Hardware and Software](https://www.amazon.com/Code-Language-Computer-Hardware-Software/dp/0735611319)

### Other

- [Go By Example](https://gobyexample.com/)
- Roadmaps:
- [Computer Science](https://roadmap.sh/computer-science)
- [Algorithms](https://neetcode.io/roadmap)
- [System Design](https://roadmap.sh/system-design)
- [Software Design Architecture](https://roadmap.sh/software-design-architecture)
- [Backend](https://roadmap.sh/backend)

# Community

Here you can find help
Expand Down
9 changes: 7 additions & 2 deletions cmd/interpreter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func main() {
// compiler
analyzer := analyzer.MustNew(resolver)
irgen := irgen.New()
p := parser.MustNew(false)
comp := compiler.New(
parser.MustNew(false),
p,
analyzer,
irgen,
)
Expand All @@ -60,7 +61,11 @@ func main() {
comp,
proto.NewAdapter(),
runTime,
builder.MustNew("/Users/emil/projects/neva/std"),
builder.MustNew(
"/Users/emil/projects/neva/std",
"/Users/emil/projects/neva/thirdparty",
p,
),
)

path, err := filepath.Abs(os.Args[1])
Expand Down
11 changes: 8 additions & 3 deletions cmd/lsp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ type Indexer struct {
type analyzerMessage string

func (i Indexer) index(ctx context.Context, path string) (src.Module, analyzerMessage, error) {
rawMod, err := i.builder.BuildModule(ctx, path)
build, err := i.builder.Build(ctx, path)
if err != nil {
return src.Module{}, "", fmt.Errorf("builder: %w", err)
}

rawMod := build.Modules[build.EntryModule] // TODO use all mods

parsedPkgs, err := i.parser.ParsePackages(ctx, rawMod.Packages)
if err != nil {
return src.Module{}, "", fmt.Errorf("parse prog: %w", err)
Expand Down Expand Up @@ -77,11 +79,14 @@ func main() { //nolint:funlen
commonlog.Configure(verbosity, nil)
logger := commonlog.GetLoggerf("%s.server", serverName)

// parser
p := parser.MustNew(*isDebug)

// compiler
terminator := typesystem.Terminator{}
checker := typesystem.MustNewSubtypeChecker(terminator)
resolver := typesystem.MustNewResolver(typesystem.Validator{}, checker, terminator)
builder := builder.MustNew("/Users/emil/projects/neva/std")
builder := builder.MustNew("/Users/emil/projects/neva/std", "/Users/emil/projects/neva/third_party/", p)

// handler and server
h := &protocol.Handler{}
Expand All @@ -92,7 +97,7 @@ func main() { //nolint:funlen
version: "0.0.1",
indexer: Indexer{
builder: builder,
parser: parser.MustNew(*isDebug),
parser: p,
analyzer: analyzer.MustNew(resolver),
},
mod: make(chan src.Module),
Expand Down
21 changes: 20 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,48 @@ require (
)

require (
github.com/go-git/go-git/v5 v5.6.1
github.com/tliron/commonlog v0.1.0
google.golang.org/protobuf v1.31.0
)

require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/sourcegraph/jsonrpc2 v0.2.0 // indirect
github.com/tliron/kutil v0.1.68 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)

require (
Expand All @@ -40,5 +59,5 @@ require (
github.com/tliron/glsp v0.2.0
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
golang.org/x/sync v0.3.0
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v3 v3.0.1
)
Loading

0 comments on commit 946976f

Please sign in to comment.