Giter Site home page Giter Site logo

natpl's People

Contributors

amadeusine avatar cuddlefishie avatar mathspy avatar pr2502 avatar repnop avatar thezoq2 avatar xd009642 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

natpl's Issues

add a way to import other `.nat` files in the REPL and other files

This would allow more re-use of definitions.

Ideally for disambiguation also a namespacing mechansim should be present.

Maybe for "import everything" and "only import the name of the namespace" different statement types could be used?

  • import OtherFile for loading OtherFile.nat from a set of known locations and then making all definitions usable
  • use OtherFile for loading OtherFile.nat from a set of known locations and then allowing the use of definitions using OtherFile.some_name

make span tracking more robust and add multi-line definitions

At the moment the parser only handles one line at a time and all spans are relative to that line.
When errors occur in a different file (see #15) then the proper error location should be tracked.

Handling multi-line definitions/expressions would also allow for more features later on, like if-else conditionals.

remove assertion item and allow variable redefinitions

Right now writing x = 5 has two meanings:

  • if x is not yet defined it will be defined to the value 5
  • if x is defined then it is asserted that x is equal to 5 and error if that's not the case

The assertion feature is very rarely used since the main usecase of natpl is in a REPL environment anyway.
This also means it's not possible to update the value of a variable.


It would be better to treat any <var> = <expr> item as a definition/value update. To implement that, the line item for disambiguation needs to be removed. Of course that requires small changes to the parser too.

MaybeDeclarationOrEqualityExpression(DeclarationOrEquality),

add an automatically loaded user-script to the REPL

This would allow users to create their own defaults for what is useful to them.

Similarly to the prelude, it would be automatically loaded on startup, but unlike the prelude could be changed by the users without recompiling the program.

Possible locations for the file:

  • ~/.natpl/user_prelude.nat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.