Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

import statements #29

Closed
pzipper opened this issue Mar 22, 2023 · 0 comments
Closed

import statements #29

pzipper opened this issue Mar 22, 2023 · 0 comments
Labels
A-cli Area: command line interface A-codegen Area: the code generator backend A-syntax Area: the parser and scanner A-typechecker Area: the type checker
Milestone

Comments

@pzipper
Copy link
Member

pzipper commented Mar 22, 2023

Syntax

import "Std";

The compiler searches the following paths for the module with the given name, in order:

  • Std
  • Std.amp
  • Std/Main.amp

Local modules can be imported using the following syntax:

import "./MyModule";

The compiler searches the following paths for the module with the given name, in order:

  • ./MyModule
  • ./MyModule.amp
  • ./MyModule/Main.amp

Command Line

This would also introduce the -I compiler flag, which would add a path to search for modules in:

amp test.amp -I runtime

Given the above example, the compiler would search the following paths for the Std module (in order):

  • runtime/Std
  • runtime/Std.amp
  • runtime/Std/Main.amp
@pzipper pzipper added A-cli Area: command line interface A-syntax Area: the parser and scanner syntax/scanner A-typechecker Area: the type checker A-codegen Area: the code generator backend labels Mar 22, 2023
@pzipper pzipper modified the milestones: 0.1-beta, 0.4.0-alpha Mar 22, 2023
pzipper added a commit that referenced this issue Mar 25, 2023
pzipper added a commit that referenced this issue Mar 25, 2023
@pzipper pzipper closed this as completed Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-cli Area: command line interface A-codegen Area: the code generator backend A-syntax Area: the parser and scanner A-typechecker Area: the type checker
Projects
None yet
Development

No branches or pull requests

1 participant