carlcui / expressive Goto Github PK
View Code? Open in Web Editor NEWGo compiler for language expressive
License: MIT License
Go compiler for language expressive
License: MIT License
"abc"
Currently only a small set of escape characters are allowed and have been parsed manually. It would be helpful to automate this part, as well as transferring them to golang escape characters. (e.g. In parsing, text would be \\n
, but the value should be \n
.
In the program, I should be able to do something like
let foo: float = 5;
instead of explicitly specifying
let foo: float = 5.0;
Need to add type conversion before this
In v0.0.1, assignmentNode has only identifier node on the lhs, but should be generalized to expressions that are addressable.
'a'
setup LLVM IR codegen from ast.
Input handler:
NextChar
to NextRune
NextByte
(Still does NextRune
, but give error when the rune size is larger than 1)byte
:
byte
char
:
string
++
, --
Basic type checking.
function as variable
Be able to scan comments
continue
in loops
Currently, it costs too much effort writing tests for the parser in these ways:
parser.Parse()
(cannot call individual parsing functions)Need better way of writing parser tests.
all except for in
, since array implementation is not done yet.
compile input file to machine executable
llvm-as
: generate llvm bitcodellvm-link
: link bitcodellc
: produce object filegcc
: create executableCon:
Consider the following code:
...
frag1 := visitor.removeValueFragment(node.expr)
frag.Append(frag1)
...
Suppose frag1
is InstructionsFragment
, and frag
is BlocksFragment
. If frag
already has Term
set, then by appending frag1
to frag
, essentially the order of execution is altered, unless we create a Block
for frag1
and then append the block to frag
.
Pro:
Not sure. Currently every fragment is at least a BlocksFragment
, even it only contains one block with one instruction. However, llvm will essentially strip out those blocks during optimization phase.
+=
, -=
, *=
, /=
, %=
, ^^=
Should be able to generate ast for basic operations:
Be able to define custom types
Otherwise we won't be able to test the compiler as a whole in circleCI
Before:
[]*token.Token{
&token.Token{TokenType: token.IF},
&token.Token{TokenType: token.LEFT_PAREN}
}
// And
cur.Locator := locator.IndexLocation{scanner.pos}
Now:
[]*token.Token{
{TokenType: token.IF}, // redundant type
{TokenType: token.LEFT_PAREN}
}
cur.Locator := locator.IndexLocation{Index: scanner.pos} // disallow unnamed fields
print "1+2 is %d\n", 3;
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.