New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@artemis-lang/lexer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artemis-lang/lexer

The artemis language lexer

latest
npmnpm
Version
0.3.4
Version published
Weekly downloads
3
50%
Maintainers
1
Weekly downloads
 
Created
Source

@artemis-lang/lexer

Lexical analyzer (tokenizer) for the Artemis programming language.

Installation

npm install @artemis-lang/lexer

Usage

import Lexer from '@artemis-lang/lexer';

const code = '(def x 42)';
const lexer = new Lexer(code);
const tokens = lexer.tokenize();

console.log(tokens);

Features

  • Tokenization: Converts source code into tokens
  • Multi-line Comments: Supports /* ... */ style comments
  • Keywords: Recognizes language keywords (def, fn, if, while, for, match, return)
  • Operators: All 18 operators (arithmetic, logical, bitwise, comparison)
  • Literals: Strings, numbers, booleans, binary, hexadecimal
  • Native Functions: 80+ built-in function identifiers
  • S-expressions: Parentheses, brackets, braces

Token Types

The lexer recognizes the following token types:

  • keyword: def, fn, if, else, while, for, match, return, class, extends, new
  • nativeFn: Built-in functions like println, push, map, filter, etc.
  • operator: +, -, *, /, %, ^, >, <, >=, <=, ==, !=, &&, ||, !, ~, <<, >>, >>>
  • number: Integer literals
  • binary: Binary literals (0b1010)
  • hex: Hexadecimal literals (0xFF)
  • boolean: true, false
  • string: Double-quoted strings
  • identifier: Variable and function names
  • lp/rp: Left/right parentheses ( )
  • lb/rb: Left/right braces { }
  • lbk/rbk: Left/right brackets [ ]
  • comma: ,
  • colon: :
  • hash: # (for sets)

Example

import Lexer from '@artemis-lang/lexer';

const code = `
  (def greeting "Hello")
  (println greeting)
`;

const lexer = new Lexer(code);
const tokens = lexer.tokenize();

// tokens will be an array of token objects
// Each token has: { type, value, line, column }

Version

Current version: 0.3.4

Documentation

For complete language documentation, see the main README.

License

MIT

Keywords

artemis

FAQs

Package last updated on 22 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts