- Dec 2023
-
eddieantonio.ca eddieantonio.ca
-
When you run your Python program using [CPython], the code is parsed and converted to an internal bytecode format, which is then executed inside the VM. From the user’s perspective, this is clearly an interpreter—they run their program from source. But if you look under CPython’s scaly skin, you’ll see that there is definitely some compiling going on. The answer is that it is both. CPython is an interpreter, and it has a compiler.
-
You can actually compile all of your Python code beforehand using the compileall module on the command line:
$ python3 -m compileall .
This will place the compiled bytecode of all Python files in the current directory in pycache/ and show you any compiler errors.
-
The fact that error messages are generated by different stages of the compiler, and compilers generally issue errors from earlier stages before continuing also means that you can discover the stages of your compiler by deliberately creating errors in a program.
-
-
mathspp.com mathspp.com
-
Recap
In this article you started implementing your own version of Python. To do so, you needed to create four main components:
A tokenizer: * accepts strings as input (supposedly, source code); * chunks the input into atomic pieces called tokens; * produces tokens regardless of their sequence making sense or not.
A parser: * accepts tokens as input; * consumes the tokens one at a time, while making sense they come in an order that makes sense; * produces a tree that represents the syntax of the original code.
A compiler: * accepts a tree as input; * traverses the tree to produce bytecode operations.
An interpreter: * accepts bytecode as input; * traverses the bytecode and performs the operation that each one represents; * uses a stack to help with the computations.
-
To write our compiler, we'll just create a class with a method compile. The method compile will mimic the method parse in its structure. However, the method parse produces tree nodes and the method compile will produce bytecode operations.
-
The compiler is the part of our program that will take a tree (an AST, to be more precise) and it will produce a sequence of instructions that are simple and easy to follow.
-
Instead of interpreting the tree directly, we'll use a compiler to create an intermediate layer.
-
- Sep 2023
-
www.programmingtalks.org www.programmingtalks.org
-
Write your own compiler in 24 hours
Interesting need to look at this , It would be a good execercise.
Tags
Annotators
URL
-
- Feb 2022
-
www.interviewbit.com www.interviewbit.com
-
Online C++ Compiler
InterviewBit provides us with one of the best C++ compilers that is easily operated and that supports multiple programming languages.
Tags
Annotators
URL
-
- Jan 2022
-
www.ruby-lang.org www.ruby-lang.org
-
Ruby 2.6 introduces an initial implementation of a JIT (Just-In-Time) compiler. The JIT compiler aims to improve the performance of Ruby programs. Unlike traditional JIT compilers which operate in-process, Ruby’s JIT compiler writes out C code to disk and spawns a common C compiler to generate native code. For more details about it, see the MJIT organization by Vladimir Makarov.
-
- Dec 2021
-
markupuk.org markupuk.org
-
We only needed to convert Java constructs that Saxon actually uses
-
- Jan 2021
-
stackoverflow.com stackoverflow.com
-
If you manage to make Svelte aware of what needs to be tracked, chances are that the resulting code will be more performant than if you roll your own with events or whatever. In part because it will use Svelte's runtime code that is already present in your app, in part because Svelte produces seriously optimized change tracking code, that would be hard to hand code all while keeping it human friendly. And in part because your change tracking targets will be more narrow.
-
- Dec 2020
-
en.wikipedia.org en.wikipedia.org
-
Rather than compiling directly to machine code or assembly language, it compiles to a lower-level intermediate language. It source-to-source compiles to C, which is then compiled with a C compiler for a given platform, such as GCC.
-
-
github.com github.com
-
I'm also not a fan of compilers-needed mentality in general.
-
- Nov 2020
-
news.ycombinator.com news.ycombinator.com
-
Frontend frameworks are a positive sum game! Svelte has no monopoly on the compiler paradigm either. Just like I think React is worth learning for the mental model it imparts, where UI is a (pure) function of state, I think the frontend framework-as-compiler paradigm is worth understanding. We're going to see a lot more of it because the tradeoffs are fantastic, to where it'll be a boring talking point before we know it.
-
- Oct 2020
-
github.com github.com
-
browserify is a tool for compiling node-flavored commonjs modules for the browser.
-
-
medium.com medium.com
-
Svelte takes advantage from its position as compiler to make reactivity a language feature
-
-
github.com github.com
-
Typically, unified compilers return string. This compiler returns a ReactElement.
Tags
Annotators
URL
-
- Sep 2020
-
github.com github.com
-
svelte.dev svelte.dev
-
Because Svelte is a compiler, we're not bound to the peculiarities of JavaScript: we can design a component authoring experience, rather than having to fit it around the semantics of the language.
-
-
fermatslibrary.com fermatslibrary.com
-
For example, the one- pass (hardware) translator generated a symbol table and reverse Polish code as in conven- tional software interpretive languages. The translator hardware (compiler) operated at disk transfer speeds and was so fast there was no need to keep and store object code, since it could be quickly regenerated on-the-fly. The hardware-implemented job controller per- formed conventional operating system func- tions. The memory controller provided
Hardware assisted compiler is a fantastic idea. TPUs from Google are essentially this. They're hardware assistance for matrix multiplication operations for machine learning workloads created by tools like TensorFlow.
-
-
www.codingwithjesse.com www.codingwithjesse.com
-
Svelte, on the other hand, is a compiler. In a way, Svelte is more like a programming language than a library.
-
- Jul 2020
-
docdrop.org docdrop.org
-
Made analogy with internal combustion engine, which has 1000s of parts, with the "radical simplicity" approach taken by Tesla: they use an electric motor, which only has 2 components!
comparison: Sapper vs. Gatsby
-
- Jan 2020
-
ambrevar.xyz ambrevar.xyz
- Nov 2019
-
reasonml.github.io reasonml.github.io
-
Reason compiles to JavaScript thanks to our partner project, BuckleScript, which compiles OCaml/Reason into readable JavaScript with smooth interop. Reason also compiles to fast, barebone assembly, thanks to OCaml itself.
-
- Sep 2018
- Mar 2018
-
web.cs.ucla.edu web.cs.ucla.edu
-
compiler structure; lexical and syntactic analysis; semantic analysis and code generation; theory of parsing
编译器需要学习的主题:
- 编译器结构
- 词法与语法分析
- 语义分析与代码生成
- parsing theory
-
-
tiarkrompf.github.io tiarkrompf.github.io
-
CS352: Compilers: princeples and practive
Tags
Annotators
URL
-
-
www.cs.put.poznan.pl www.cs.put.poznan.pl
-
Static Code Analysis
Tags
Annotators
URL
-
-
www.cambridge.org www.cambridge.org
-
the MiniJava project
Tags
Annotators
URL
-
-
-
www.cambridge.org www.cambridge.org
-
Modern Compiler Implementation in Java
-
-
web.cs.ucla.edu web.cs.ucla.edu
-
The Java Tree Builder
JTB: JavaCC 的前端
-