1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00
Commit graph

56 commits

Author SHA1 Message Date
809613ef8b LuaJIT compatibility
Spoiler alert: Anselme run ~1.5x slower in LuaJIT than Lua 5.3/5.4. I didn't expected LuaJIT to be able to optimize anything with my super performant and cache friendly AST walker interpreter, but being this much slower is kinda impressive.
2023-12-28 17:37:57 +01:00
82ce53be83 First test batch and associated fixes
The test runner is also nicer to use.
2023-12-28 17:03:54 +01:00
10084dec23 Return break while loops 2023-12-28 14:51:55 +01:00
a7f2362199 Typed swap value & type order 2023-12-28 14:30:28 +01:00
e71bff9562 Replace persistent variable system
Previous system linked the variable name with the saved value, meaning the variable could not be renamed or moved outside the global scope.

Instead we propose to store all persistent values in a global table, identifying each by a key. To still allow nice manipulation with identifiers, the alias syntax replace the persistent syntax for symbols - an aliases symbol will act as if a function call was used in place of the identifier when it appear.
2023-12-27 21:25:14 +01:00
56ed6c912b Replace checkpoint system
The previous system needed to store of the scope and full AST to build a Resumable object, which means that if persisted, updating the resumable script will have no effect.
The new system instead uses an anchor token and does not require any information besides the anchor name.
2023-12-27 17:06:35 +01:00
c4636343b4 Translation system first draft 2023-12-26 20:03:06 +01:00
fe351b5ca4 Anselme v2.0.0-alpha rewrite
Woke up and felt like changing a couple things. It's actually been worked on for a while, little at a time...

The goal was to make the language and implementation much simpler. Well I don't know if it really ended up being simpler but it sure is more robust.

Main changes:
* proper first class functions and closures supports! proper scoping rules! no more namespace shenanigans!
* everything is an expression, no more statements! make the implementation both simpler and more complex, but it's much more consistent now! the syntax has massively changed as a result though.
* much more organized and easy to modify codebase: one file for each AST node, no more random fields or behavior set by some random node exceptionally, everything should now follow the same API defined in ast.abstract.Node

Every foundational feature should be implemented right now. The vast majority of things that were possible in v2 are possible now; some things aren't, but that's usually because v2 is a bit more sane.
The main missing things before a proper release are tests and documentation. There's a few other things that might be implemented later, see the ideas.md file.
2023-12-22 13:25:28 +01:00
5e441886c0 Add anonymous functions 2022-09-28 14:56:31 +09:00
2c6d66c222 Variable must now be explicitly marked as persistent 2022-09-27 19:27:23 +09:00
e9606cdee0 Add text buffer syntax 2022-09-27 17:05:06 +09:00
ccaa40a99d Add rounding functions 2022-09-17 01:36:01 +09:00
f0ecfbb43b Update builtin scripts 2022-09-16 20:23:01 +09:00
ef5e1a577f Re-add alternative : operator for pairs 2022-09-16 14:19:48 +09:00
d1f49d1894 Preprend every definition line type with a colon, remove function decorator, add immediately ran definition line 2022-09-14 15:28:58 +09:00
1263c32572 Implicitly call references like functions 2022-09-10 17:58:34 +09:00
95462391e3 Add maps; remove map emulation functionality from list; function and tags now internally use maps instead of lists 2022-09-09 21:39:37 +09:00
bac5cdde01 Change equality test to reference comparison for mutable values 2022-09-09 14:57:31 +09:00
95683a0ffd Add constants 2022-09-08 22:09:11 +09:00
3e658e4780 Add variable constraints, rename type annotation checks to constraints, rename custom type to annotation 2022-09-08 21:28:27 +09:00
47f95fc04a Add object type, dot operator can return function references 2022-06-09 17:07:58 +09:00
c4fb2649c2 Stdlib: add string!len, table!concat, _%_ 2022-01-16 00:16:06 +01:00
fd07db83f2 Add implicit multiplication 2022-01-14 21:32:14 +01:00
88157b04b9 Merge behavior of : and = into single = operator for pairs; add assignment with _._ operator in function references 2021-12-14 02:37:09 +01:00
48cabbf4c0 Add while loop line and operator 2021-12-12 20:49:48 +01:00
f5382d2912 Add _; 2021-12-12 16:31:19 +01:00
bb45cc8fdd Fix scoping with mutable variables 2021-12-12 15:38:27 +01:00
16d0bb8d7a Fix LuaJIT compatibility 2021-12-11 01:38:18 +01:00
fef498b3d7 Add scoped functions 2021-12-11 01:05:01 +01:00
3d32f35d67 Omit function variables from merge 2021-12-10 21:25:05 +01:00
40c1616cce Rewrite next, random using references 2021-12-09 17:23:54 +01:00
acb8945dec Add variable reference and use them in alias(ref, id) 2021-12-09 14:34:21 +01:00
037654ebcf Bump version, update doc 2021-12-06 18:48:32 +01:00
04c6683de8 Proper checkpointing of mutable values 2021-12-06 18:34:58 +01:00
bc5e68ffcb Remove text litterals as events buffers may contain code blocks (choices events) and we don't want this to end up in the save file 2021-12-06 16:15:35 +01:00
9bd9759115 Rename overloaded operators (add underscores)
* add suffix unary operators
* add _! operator
* _._ and _&_ operator overloading
* allow calling function references with _! and access variables with _._
* rename . method operator to !
* various cleaning & improvements

Documentation will follow at some point.
2021-12-06 01:45:19 +01:00
d5b1a9f225 Allow argument-less calling using ! suffix 2021-12-04 18:51:09 +01:00
6e5cbf9e7e Add function references 2021-12-04 18:20:32 +01:00
0f89307d5f Cache read values in local state, handle mutable variables properly 2021-12-02 23:57:25 +01:00
607313d5ce Merge state on vm:eval, new aliases need to be merged 2021-12-02 19:24:48 +01:00
721464218c Add eventbuffer type 2021-12-02 18:39:43 +01:00
38b2a6ae69 Improve function decorator parsing 2021-11-28 16:23:44 +01:00
633f7b2d61 Prevent from restarting interpreter after return or error 2021-06-05 22:38:02 +02:00
d42c35facd Change versioning to separate language/API/save; allow executing blocks directly; add version to game config 2021-06-05 17:19:42 +02:00
9388a22a0f Move default variables alias from game config to language file 2021-06-05 14:01:54 +02:00
61e3143e9e Add alias() to define alias after definition; add frFR language file 2021-06-05 01:30:40 +02:00
198c06e2e8 Rename format to {} 2021-06-05 00:06:00 +02:00
64bc85741a Changed a few things
- Bumped to 0.15.0
- Add boot script
- Change variable definition syntax, using a = to distinguish more cleary between identifier and value
- Variables initial values are evaluated on first use instead of at parsing time
- Error on variable redefinition. Means you should make sure to load saves after your scripts.
- Improve string parsing, support for escape codes
- Remove support for number literals with empty decimal part (42. for 42.0) as there's no distinction in Anselme and it conflicts with .function call suffix
- Changed priority of : pair operator
- Add type type, and type annotations to variables and function parameters
- Change Lua function system to use regular Anselme functions
  - Defining a function from Lua is now way simpler and require providing a full Anselme function signature
- Change Anselme function system
  - Dynamic dispatch, based on arity, type annotation and parameter names. Will select the most specific function at runtime.
  - Define way to overload most operators
  - Allow custom type to text formatters
  - Allow assignment to custom functions
  - Index operator ( renamed to ()
  - Functions with parameters each have their own private namespace (scoping ersatz)
  - Internal: "custom"-mode operators now have their own expression AST type instead of cluttering the function system
- Remove static type checker as it is barely useful with new function system. May or may not rewrite one in the future.
- Improve error messages here and there
- Internal: cleaning
2021-06-03 15:29:25 +02:00
4b139019c9 Add list assignment operators 2021-04-25 19:10:37 +02:00
b93061143c Add name and value pair methods 2021-04-25 18:46:22 +02:00