From f551da3dd760493c30bda9ae2887abdf5b0814d6 Mon Sep 17 00:00:00 2001 From: alpha Date: Sat, 16 Jul 2022 21:28:44 +0000 Subject: [PATCH] chapter 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > 2. This informal introduction leaves a lot unspecified. List several open > questions you have about the languageā€™s syntax and semantics. What do you > think the answers should be? - String escaping, Unicode? - Interaction with the system (i.e., exit status code)? - What are the built-in errors? - What happens when we all a function with the wrong number of arguments? It would be cool if it were curried... - Multiple inheritance? > 3. Lox is a pretty tiny language. What features do you think it is missing > that would make it annoying to use for real programs? (Aside from the > standard library, of course.) No way to interact with the outside world, whether that's files, stdin, or networking. No parallelization. Somewhat reminiscent of Lua, really. FossilOrigin-Name: 394141a0b92ff762adcc54b53e4a04786a5374ad42fe312be5c20b6666dbb3f5 --- README.md | 8 ++++++++ lox/fib.lox | 9 +++++++++ lox/hello.lox | 1 + 3 files changed, 18 insertions(+) create mode 100644 lox/fib.lox create mode 100644 lox/hello.lox diff --git a/README.md b/README.md index 94cea84..c9e94c0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Crafting Interpreters - [Crafting Interpreters](https://craftinginterpreters.com/) + +## Installing Lox + +```sh +brew install --HEAD kejadlen/personal/lox +``` + + diff --git a/lox/fib.lox b/lox/fib.lox new file mode 100644 index 0000000..c62fe30 --- /dev/null +++ b/lox/fib.lox @@ -0,0 +1,9 @@ +fun fib(n) { + if (n == 2) { + return 2; + } else { + return n * fib(n - 1); + } +} + +print fib(5); diff --git a/lox/hello.lox b/lox/hello.lox new file mode 100644 index 0000000..6cf5a8e --- /dev/null +++ b/lox/hello.lox @@ -0,0 +1 @@ +print "hello world";