All Projects → KFlash → Seafox

KFlash / Seafox

Licence: isc
A blazing fast 100% spec compliant, self-hosted javascript parser written in Typescript

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
ecmascript
72 projects

Projects that are alternatives of or similar to Seafox

Meriyah
A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah
Stars: ✭ 690 (+62.35%)
Mutual labels:  tc39, parser, parsing
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (-48.94%)
Mutual labels:  tc39, parser, parsing
Parse Xml
A fast, safe, compliant XML parser for Node.js and browsers.
Stars: ✭ 184 (-56.71%)
Mutual labels:  parser, parsing
Lief
Authors
Stars: ✭ 2,730 (+542.35%)
Mutual labels:  parser, parsing
Goose Parser
Universal scrapping tool, which allows you to extract data using multiple environments
Stars: ✭ 211 (-50.35%)
Mutual labels:  parser, parsing
Rats
Movie Ratings Synchronization with Python
Stars: ✭ 156 (-63.29%)
Mutual labels:  parser, parsing
Command Line Api
Command line parsing, invocation, and rendering of terminal output.
Stars: ✭ 2,418 (+468.94%)
Mutual labels:  parser, parsing
Whispers
Identify hardcoded secrets and dangerous behaviours
Stars: ✭ 66 (-84.47%)
Mutual labels:  parser, parsing
Sywac
🚫 🐭 Asynchronous, single package CLI framework for Node
Stars: ✭ 109 (-74.35%)
Mutual labels:  parser, parsing
Buntis
A 100% compliant, self-hosted typescript parser that emits an ESTree-compatible AST
Stars: ✭ 90 (-78.82%)
Mutual labels:  tc39, parsing
Cherow
Very fast and lightweight, standards-compliant, self-hosted javascript parser with high focus on both performance and stability
Stars: ✭ 1,539 (+262.12%)
Mutual labels:  tc39, parsing
Parjs
JavaScript parser-combinator library
Stars: ✭ 145 (-65.88%)
Mutual labels:  parser, parsing
Dan Jurafsky Chris Manning Nlp
My solution to the Natural Language Processing course made by Dan Jurafsky, Chris Manning in Winter 2012.
Stars: ✭ 124 (-70.82%)
Mutual labels:  parser, parsing
Cppsharp
Tools and libraries to glue C/C++ APIs to high-level languages
Stars: ✭ 2,221 (+422.59%)
Mutual labels:  parser, parsing
Whois Parser
Go(Golang) module for domain whois information parsing.
Stars: ✭ 123 (-71.06%)
Mutual labels:  parser, parsing
Arpeggio
Parser interpreter based on PEG grammars written in Python http://textx.github.io/Arpeggio/
Stars: ✭ 204 (-52%)
Mutual labels:  parser, parsing
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (-78.59%)
Mutual labels:  parser, parsing
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (-77.41%)
Mutual labels:  parser, parsing
Neodoc
Beautiful, hand-crafted commandline interfaces for node.js
Stars: ✭ 221 (-48%)
Mutual labels:  parser, parsing
Nearley
📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
Stars: ✭ 3,089 (+626.82%)
Mutual labels:  parser, parsing

Seafox

A blazing fast 100% spec compliant, self-hosted javascript parser written in Typescript.


Seafox NPM GitHub license Total alerts Circle License

Features

  • Conforms to the standard ECMAScript® 2021 (ECMA-262 11th Edition) language specification
  • Support for additional ECMAScript features for Web Browsers
  • Optionally track syntactic node locations
  • Emits an ESTree-compatible abstract syntax tree
  • Lexical analysis
  • No backtracking
  • Low memory usage
  • Insane performance both on desktop computers and handheld devices
  • Twice as fast as other Javascript parsers
  • Very well tested (~33 000 unit tests with full code coverage)
  • Lightweight - ~84 KB minified

Installation

npm install seafox --save-dev

API

Seafox generates AST according to ESTree AST format, and can be used to perform syntactic analysis (parsing) or lexical analysis (tokenization) of a JavaScript program, and with ES2015 and later a JavaScript program can be either a script or a module.

The parse method exposed by Seafox takes an optional options object which allows you to specify whether to parse in script mode (the default) or in module mode.

This is the available options:

{
  // Allow parsing using Module as the goal symbol
  module?: boolean;

  // The flag to enable start and end offsets and line/column location information to each node
  loc: false;

  // Disable web compatibility
  disableWebCompat: false;

  // The flag to attach raw property to each literal and identifier node
  raw: false;

  // Enabled directives
  directives: false;

  // The flag to allow return in the global scope
  globalReturn: false;

  // The flag to enable implied strict mode
  impliedStrict: false;

// Enable non-standard parenthesized expression node
  preserveParens: false;

   // Allows token extraction. Accepts only a function
  onToken: function() {}
}

Example usage:

import { parseScript, parseModule, parse } from './seafox';

parseScript('({x: [y] = 0} = 1)');

parseModule('({x: [y] = 0} = 1)', { directives: true, raw: true });

parse('({x: [y] = 0} = 1)', { module: true });

parse('({x: [y] = 0} = 1)');

Lexical analysis

Lexical analysis can only be done during parsing and accepts only a function type as the option

 parseScript('foo = bar', { onToken: () => {}});

The callback function have 4 arguments.

Arguments Description
token The token to be extracted
value Value of the extracted token
start Start position of the extracted token
end End position of the extracted token

The loc option needs to be enabled for start and end. Otherwise this values will be set to undefined

Performance

Seafox is developed for performance and low memory usage, and the parser is about 2x - 4x faster than all other javascript parsers.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].