belatuk_symbol_table 5.2.0 copy "belatuk_symbol_table: ^5.2.0" to clipboard
belatuk_symbol_table: ^5.2.0 copied to clipboard

A generic symbol table implementation in Dart, with support for scopes and constants.

example/main.dart

import 'package:belatuk_symbol_table/belatuk_symbol_table.dart';

void main(List<String> args) {
  //var mySymbolTable = SymbolTable<int>();
  var doubles =
      SymbolTable<double>(values: {'hydrogen': 1.0, 'avogadro': 6.022e23});

// Create a new variable within the scope.
  doubles.create('one');
  doubles.create('one', value: 1.0);
  doubles.create('one', value: 1.0, constant: true);

// Set a variable within an ancestor, OR create a new variable if none exists.
  doubles.assign('two', 2.0);

// Completely remove a variable.
  doubles.remove('two');

// Find a symbol, either in this symbol table or an ancestor.
  //var symbol1 = doubles.resolve('one');

// Find OR create a symbol.
  //var symbol2 = doubles.resolveOrCreate('one');
  //var symbol3 = doubles.resolveOrCreate('one', value: 1.0);
  //var symbol4 = doubles.resolveOrCreate('one', value: 1.0, constant: true);
}
0
likes
160
points
435
downloads

Publisher

verified publisherdukefirehawk.com

Weekly Downloads

A generic symbol table implementation in Dart, with support for scopes and constants.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection

More

Packages that depend on belatuk_symbol_table