What can we learn from how compilers are designed?
- (It’s parsing an abstract token stream, it has no notion of a file!) By separating these things, we end up having to manually re-implement something like location tracking because ostensibly that token stream might have come from something other than the lexer, and these tools are trying not to couple with each other.
- Indeed, if we stop and look at a high-level at what a language’s grammar is, we see that not only is a lexer an implicit part of the specification, and the parser also an implicit part, but there’s also an implicit data structure involved: the “concrete syntax tree.” (Basically, look at the grammar as a set of algebraic data type declarations.) We might start to get suspicious of our design when our single high-level description of a language’s grammar gets cut up into three artificially separated components that create more work for us.
Repl.It 1.0: IDE that Grows from Playgrounds to Fullstack Apps
- If you want to use files, write to files, split your code into modules, etc., you just do that and behinds the scenes the environment will switch to one where you're interacting with the filesystem.
- You use it to listen on a port, any port you'd like; we'll detect that, host your server/repl on your Repl.it subdomain (forever!) and that's it you're developing/deploying an application.
- We also know that not all applications will grow incrementally so in typical Repl.it one-click-start fashion we've pre-setup a Django, Rails, Express, and Sinatra apps.
- Repl.it serverless apps are unique in that they're stateful and that the same repl, same protocol, same everything, that you use in development is deployed and running in production.
- After getting user-interest @pyelias is starting to explore building a full stack application using Django.
Rust's 2018 roadmap
- Part of the goal with the Rust 2018 release is to provide high quality documentation for the full set of new and improved features and the idioms they give rise to.
- The Rust Programming Language book has been completely re-written over the last 18 months, and will be updated throughout the year as features reach the stable compiler.
- Building on our work from last year, we will publish a 1.0 version of the Rust API guidelines book, continue pushing important libraries to 1.0 status, improve discoverability through a revamped cookbook effort, and make heavy investments in libraries in specific domains—as we’ll see below.
- The roadmap does not stipulate exactly what these resources should look like — probably there should be several kinds — but commits us as a community to putting significant work into this space, and ending the year with some solid new material.
Demystifying Virtual and Abstract Functions
- Or maybe you encountered some weird code in the class definition, things like virtual and =0;.
- So, instead of writing two (or more) functions that do the same thing for each type of animal, we just accept the base class (or a pointer/reference to it) as the argument type.
- By default, the compiler looks to the base class for the function definition.
- virtual tells the computer to look at the derived class for the function definition instead.
- Looking at our class design, we also realize that speak() is a rather stupid function to define in Animal...printing "[undefined sound]" just looks dumb.
- Now, one word of caution: if you define a function as pure virtual or abstract (i.e. virtual thefunc() = 0;, you MUST define it in each derived class.
- Arguably, that's one of the benefits of pure virtual functions...the compiler is able to step in and keep you from doing stupid things.
- Schism is an experimental self-hosting compiler from a subset of R6RS Scheme to WebAssembly.
- Now that self-hosting has been achieved, development can shift towards supporting a more complete subset of Scheme.
- This includes implementing garbage collection, possibly using the WebAssembly GC proposal, dynamic linking and code generation, etc.
- This repository includes a very simple playground.html, which gives a lightweight way to play around with the compiler.
- The goal is to keep as much code as possible in Scheme, but the runtime is needed to interact with the rest of the world.
- Stage0 is the compiler snapshot, stored in schism-stage0.wasm.
- To add a new feature, the usual flow is to start by adding a small test that uses it.
- Once the feature is implemented, then the Stage1 and Stage2 compilers should pass the test.
- Note that you cannot use the new feature in the compiler until it works in stage2.