hbobenicio / lox Goto Github PK
View Code? Open in Web Editor NEWjlox compiler written as an exercise from the totally awesome Crafting Interpreters book
jlox compiler written as an exercise from the totally awesome Crafting Interpreters book
It doesn't make sense to care about scanner if you just need to use a parser. API would improve if scanner were inside the parser.
clox_ast_
free
into its own moduleeval
into its own moduleWhenever a new string value is evaluated by the interpreter, a new string is allocated. So, when setting a new value, the now useless old string must be deallocated.
In the end, after the eval method finish, the caller or the callee (interpreter) must deallocate the resulting string too.
#BlackLivesMatter
clox_ast_expr_visitor
and all its implementations to return an int=== Clox REPL - Press CTRL+C or CTRL+D to exit ===
> "a'
error: unterminated string. expecting token '"'
error: line 2: expecting a primary expression (a literal or an opening parentesis '('), got 'TOKEN_KIND_EOF'
error: parsing failed.
Make the lifecycle of these data independent somehow:
It's better to allocate than to depend on old data structures which are not necessarily anymore.
Look at 8.2.2
Chapter 7 - Evaluating Expressions - Challenge 2.
"Many languages define + such that if either operand is a string, the other is converted to a string and the results are then concatenated. For example, "scone" + 4 would yield scone4. Extend the code in visitBinaryExpr() to support that."
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.