ArkScript-lang / Ark

ArkScript is a small, fast, functional and scripting language for C++ projects

Home Page:https://arkscript-lang.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v4: integrate the new parser

SuperFola opened this issue · comments

WIP


It has been decided to write a new parser for ArkScript v4 ; it should help with generating understandable error messages for the user, and reduce the maintenance cost.

The integration of this new parser should be done in multiple steps:

  • the CI of the parser, I wish the keep the separate testing and fuzzing of the parser
  • replacing the current lexer and parser
  • implementing import resolving
    • update the examples, tests and standard library

Import syntax:

(import a)
(import a.b)  # everything is prefixed by b
(import foo.bar.egg)
(import foo:*)  # everything is imported in the current scope
(import foo.bar :a :b)  # we import only a and b from foo.bar, in the current scope

I'm now thinking that we will need a special syntax for modules, which were imported like (import "foo.arkm"), however (import foo.arkm) won't work.

How about:

  • (import module:foo) ; however it's a special syntax only for modules and looks a lot like (import foo.bar :egg)
  • (import *foo*) ; another special syntax
  • (import modules.foo), which might work if we put the standard library under lib. or std. ; instead of modules we could unify with lib/std but that might be conflicting and error inducing (hard to know what is a module and what isn't) ; but that poses the question: how do we, as a user, import our own module(s)?