Skip to content

Self hosted parser completion #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5118caf
Added a lot of test cases
Hejsil Mar 30, 2018
596f4b6
Fixed review commented code
Hejsil Mar 31, 2018
26e56f2
Each test now have it's own test name
Hejsil Mar 31, 2018
cda3509
Added test cases to cover all of zigs syntax
Hejsil Mar 31, 2018
4793c33
std.zig.parser now handles lib name for extern var and fn
Hejsil Mar 31, 2018
4d8f9e2
std.zig.parser now parses multi line strings
Hejsil Mar 31, 2018
975dc5a
std.zig.parser now parses char literals
Hejsil Mar 31, 2018
aabf7cf
std.zig.parser now parses null and bool literals
Hejsil Mar 31, 2018
df09c01
std.zig.parser now parses error, this and unreachable
Hejsil Mar 31, 2018
b909318
std.zig.parser now parses slicing and array access
Hejsil Apr 1, 2018
a2330d0
std.zig.parser now parses slice and array types
Hejsil Apr 3, 2018
22e38ff
std.zig.tokenizer fixed tokens having wrong column and line
Hejsil Apr 3, 2018
b424cd7
std.zig.parser refactored call, slice and array access to be suffix op
Hejsil Apr 3, 2018
0b9247f
std.zig.parser Refactor:
Hejsil Apr 3, 2018
5c82ed2
std.zig.parser now parses initializers... Or, it would, if it worked
Hejsil Apr 3, 2018
9d69e94
std.zig.parser now parses grouped expressions
Hejsil Apr 3, 2018
40f35e9
std.zig.parser moved container initializer tests down
Hejsil Apr 3, 2018
4fae452
std.zig.parser Refactored top level decl parsing
Hejsil Apr 3, 2018
d602f12
std.zig.ast Added ContainerDecl
Hejsil Apr 3, 2018
ec611bf
std.zig.parser now parses regular enums, unions and struct
Hejsil Apr 3, 2018
09cf823
std.zig.parser now parses container decls
Hejsil Apr 4, 2018
020724c
std.zig.tokenizer Tokens now don't contain a line and column field.
Hejsil Apr 4, 2018
ca0085c
std.zig.parser now parses error set declarations
Hejsil Apr 4, 2018
744416c
std.zig.parser should now parse operators with precedence.
Hejsil Apr 4, 2018
779247b
std.zig Major Refactor
Hejsil Apr 4, 2018
e45de60
std.zig.parser: Initializers are now parsed and fmt correctly
Hejsil Apr 6, 2018
f667744
std.zig.parser Fixed:
Hejsil Apr 6, 2018
820de17
std.zig.parser now parses labeled blocks.
Hejsil Apr 6, 2018
bdff5bf
std.zig.parser now parses switch
Hejsil Apr 6, 2018
e4d0b46
std.zig.parser WIP generalizing parsing of payloads
Hejsil Apr 8, 2018
e260c8c
std.zig.parser now parses while loops and labeled break and continue
Hejsil Apr 9, 2018
e24409e
std.zig.parser unified code for rendering and parsing semicolon in st…
Hejsil Apr 9, 2018
7dd55a8
std.zig.parser now parses for loops
Hejsil Apr 9, 2018
c19f5a2
std.zig.parser now parses if statements
Hejsil Apr 9, 2018
d04346d
ast.zig.parser now parses defer statements
Hejsil Apr 9, 2018
7d32c95
std.zig.parser now parses comptime
Hejsil Apr 9, 2018
aa55263
std.zig.parser now parses fn types
Hejsil Apr 9, 2018
a09bb40
std.zig.parser now parses asm expressions
Hejsil Apr 9, 2018
2c7996f
std.zig.parser can now render asm expressions
Hejsil Apr 10, 2018
5cd69ee
std.zig.parser changed assign expr to only be allowed in some contexts
Hejsil Apr 10, 2018
f85b9f2
std.zig.parser now parses coroutine code
Hejsil Apr 10, 2018
34af38e
std.zig.tokinizer: fixed failing tests
Hejsil Apr 10, 2018
1b81e40
std.zig: fixed compiler errors
Hejsil Apr 10, 2018
706e0d7
std.zig.parser readded all tests
Hejsil Apr 10, 2018
db0812d
std.zig.parser: changed block exprs from primary expr to expr
Hejsil Apr 10, 2018
3b80e66
std.zig.parser now parses toplevel use
Hejsil Apr 10, 2018
aa09e7b
std.zig.tokinizer now treats string identifiers as identifiers
Hejsil Apr 10, 2018
db9a9f3
std.zig.parser now parses the `var` type
Hejsil Apr 10, 2018
b9cccce
std.zig.ast: fixed none compiling code
Hejsil Apr 10, 2018
c6aa637
std.zig.parser: removed dublicate "zig fmt: coroutines" test
Hejsil Apr 10, 2018
0ba85ea
std.zig.parser fixed segfault when parsing cc for fn decl
Hejsil Apr 10, 2018
b553b7a
Merge branch 'master' into self-hosted-parser
thejoshwolfe Apr 11, 2018
27e881c
fix another undefined deref
andrewrk Apr 11, 2018
f6c7774
add memmove to builtin.o
andrewrk Apr 11, 2018
405a239
zig fmt while-else with no blocks
thejoshwolfe Apr 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions std/special/builtin.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,43 @@ pub fn panic(msg: []const u8, error_return_trace: ?&builtin.StackTrace) noreturn
}
}

// Note that memset does not return `dest`, like the libc API.
// The semantics of memset is dictated by the corresponding
// LLVM intrinsics, not by the libc API.
export fn memset(dest: ?&u8, c: u8, n: usize) void {
export fn memset(dest: ?&u8, c: u8, n: usize) ?&u8 {
@setRuntimeSafety(false);

var index: usize = 0;
while (index != n) : (index += 1)
(??dest)[index] = c;

return dest;
}

// Note that memcpy does not return `dest`, like the libc API.
// The semantics of memcpy is dictated by the corresponding
// LLVM intrinsics, not by the libc API.
export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) void {
export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) ?&u8 {
@setRuntimeSafety(false);

var index: usize = 0;
while (index != n) : (index += 1)
(??dest)[index] = (??src)[index];

return dest;
}

export fn memmove(dest: ?&u8, src: ?&const u8, n: usize) ?&u8 {
@setRuntimeSafety(false);

if (@ptrToInt(dest) < @ptrToInt(src)) {
var index: usize = 0;
while (index != n) : (index += 1) {
(??dest)[index] = (??src)[index];
}
} else {
var index = n;
while (index != 0) {
index -= 1;
(??dest)[index] = (??src)[index];
}
}

return dest;
}

comptime {
Expand Down
Loading