Coder Social home page Coder Social logo

taal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

taal's Issues

Better way to load in configs

The global node variable containing flags is not really optimal, since we want the taal compiler to be able to be used as a node library (for now), especially when I want to compile multiple files parallel/incremental.

I am not really sure how I would want to fix it though.

Everything is a function philosophy

the way main functions are compiled are a bit weird now, and I am especially struggling with variable assignment now.

The script object should just be a list of functions, and have a reference to the index of the main function.

We don't want an entry function in design, we still want to have the script like feel where you can write anything in the parent scope of the entry file.

Essentially this taal code

print 1 + 1

fn hey {
    print 300
}

hey()

represents this

fn hey {
    print 300
}

fn start {
    print 1 + 1
    hey()
}

so it would make sense to treat everything in the parent scope as a seperate function both in the parser and compiler. This way, later on people can also create library binaries that don't have an entry point easier.

Optimize binary expressions

So, we have this AST, representing 100 + 200 + 300.

{
	"type": "binary",
	"operator": "+",
	"left": {
		"type": "binary",
		"operator": "+",
		"left": {
			"type": "numberLiteral",
			"value": 100
		},
		"right": {
			"type": "numberLiteral",
			"value": 200
		}
	},
	"right": {
		"type": "numberLiteral",
		"value": 300
	}
}

In the end they are all number literals, so we can just optimize this to the expression below, because at compiletime we know these numbers will never change, they are constant.

{
	"type": "numberLiteral",
	"value": 600
}

Functions with 6+ arguments don't work

Whenever we have more than 6 arguments, they get pushed on the stack due to the System V Application Binary Interface calling conventions.

However, because of the way our functions are constructed right now, we're popping empty values of the stack?

Rework the runner

At this moment, it is all based around running it as a process, but in fact we want to be able to run the compiler as a library too.

Promisify the compile step that calls nasm and linker, and handle process exits and error logs in the part that does cli stuff.

Is required for closing #3

I need unit tests/integration tests

Something tells me I am breaking all kinds of stuff while adding new stuff.

I should probably set up some kind of testing mechanism, and use Travis for ci.

Local variables get overwritten in the stack

so, when i do this

mov [rdp-8], 10
mov [rdp-12], 100

rdp-8 is set to 0?

Should probably research why this is happening, because reassignment of vars is practically impossible now

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.