webster

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2023 License: MIT

README

The Webster Programming Language

Webster is a new programming language that combines the best features of TypeScript, Rust, Go, and Swift. It is a typed language with a syntax similar to Ruby.

Here is an outline of the project structure and the main components of the webster programming language implemented in Go:

webster/
|-- cmd/
|   |-- web/
|   |   `-- main.go
|-- lexer/
|   |-- lexer.go
|   `-- token.go
|-- parser/
|   |-- ast.go
|   |-- parser.go
|   `-- syntax.go
|-- evaluator/
|   |-- evaluator.go
|   `-- environment.go
|-- object/
|   |-- object.go
|   `-- types.go
|-- stdlib/
|   |-- arrays.wb
|   |-- dictionaries.wb
|   `-- strings.wb
|-- example.wb
`-- README.md
  1. main.go This file contains the main function that will be the entry point of the program. It will parse command line arguments, read the input .wb file, and call the lexer, parser, and evaluator to execute the code.

  2. lexer.go This file contains the Lexer struct and its associated methods. The Lexer tokenizes the input code and generate a sequence of tokens for the parser to consume.

  3. token.go This file defines the Token struct, which represents individual tokens generated by the lexer.

  4. ast.go This file defines the various AST node types, such as expressions, statements, and declarations.

  5. parser.go This file contains the Parser struct and its associated methods. The Parser will consume the tokens generated by the Lexer and produce an Abstract Syntax Tree (AST) for the evaluator to process.

  6. syntax.go This file defines the grammar rules of the Webster language, including the precedence of operators, the structure of expressions, and the syntax for declarations and statements.

  7. evaluator.go This file contains the Evaluator struct and its associated methods. The Evaluator will traverse the AST produced by the Parser, evaluate expressions, and execute statements in the appropriate environment.

  8. environment.go This file defines the Environment struct, which stores the values of variables and functions during program execution.

  9. object.go This file defines the various object types used in the Webster language, such as integers, strings, and arrays.

  10. types.go This file defines the type system for the Webster language, including type inference rules and type checking mechanisms.

  11. arrays.wb, dictionaries.wb, strings.wb These files contain the implementation of standard library functions for arrays, dictionaries, and strings, respectively, written in the Webster language.

  12. example.wb This file contains an example program written in the Webster language to showcase its features and demonstrate its syntax.

  13. README.md This file contains documentation for the project, including installation instructions, usage guidelines, and a description of the language's features.

Getting started

To start using the Webster language, follow these steps:

  1. Install webster programming language using npm as:
npm install wster
  1. Open your terminal and execute .wb file as:
# Assuming we have an example.wb file
wster example.wb

Or create web executable locally yourself:

  1. Install Go.

  2. Clone the project:

git clone https://github.com/avosa/webster.git
  1. Change to the webster directory:
cd webster
  1. Build the web command:
go build -o web ./cmd/web`
  1. Move the wster executable to a directory in your PATH. For example, on Unix-based systems (Linux, macOS), you can move it to /usr/local/bin:
sudo mv web /usr/local/bin
  1. Open your terminal and execute .wb file:
# Assuming we have an example.wb file
web example.wb

Now you're ready to explore the features of the Webster language and start writing your own programs!

To learn more about the webster programming language visit the docs section.

Copyright (c) 2023 Webster Avosa

Source code is released under the MIT license.

Directories

Path Synopsis
cmd
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL