All Projects → hpi-swa → Ohm-S

hpi-swa / Ohm-S

Licence: MIT license
A Squeak/Smalltalk implementation of the metaprogramming framework Ohm.

Programming Languages

smalltalk
420 projects

Projects that are alternatives of or similar to Ohm-S

parson
Yet another PEG parser combinator library and DSL
Stars: ✭ 52 (+188.89%)
Mutual labels:  parsing, parsing-expression-grammar
ohm-editor
An IDE for the Ohm language (JavaScript edition)
Stars: ✭ 78 (+333.33%)
Mutual labels:  parsing, ohm
pe
Fastest general-purpose parsing library for Python with a familiar API
Stars: ✭ 21 (+16.67%)
Mutual labels:  parsing, parsing-expression-grammar
autumn
A Java parser combinator library written with an unmatched feature set.
Stars: ✭ 112 (+522.22%)
Mutual labels:  parsing, parsing-expression-grammar
pyrser
A PEG Parsing Tool
Stars: ✭ 32 (+77.78%)
Mutual labels:  parsing, parsing-expression-grammar
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (-5.56%)
Mutual labels:  parsing, parsing-expression-grammar
cppcombinator
parser combinator and AST generator in c++17
Stars: ✭ 20 (+11.11%)
Mutual labels:  parsing, parsing-expression-grammar
Singulink.IO.FileSystem
Reliable cross-platform strongly-typed file/directory path manipulation and file system access in .NET.
Stars: ✭ 16 (-11.11%)
Mutual labels:  parsing
attach-juxtapose-parser
Code for the paper "Strongly Incremental Constituency Parsing with Graph Neural Networks"
Stars: ✭ 25 (+38.89%)
Mutual labels:  parsing
kataw
An 100% spec compliant ES2022 JavaScript toolchain
Stars: ✭ 303 (+1583.33%)
Mutual labels:  parsing
MP4Parse
C++ library for MP4 file parsing.
Stars: ✭ 55 (+205.56%)
Mutual labels:  parsing
ohmfork-autoclaim
automatically claim and restake vested bonds (mints) from SnowbankDAO, KlimaDAO, Wonderland, and other OlympusDAO forks
Stars: ✭ 40 (+122.22%)
Mutual labels:  ohm
bracer
Java library for parsing and evaluating math expressions
Stars: ✭ 18 (+0%)
Mutual labels:  parsing
Compiler-written-in-Haskell
A Turing complete language 😉
Stars: ✭ 31 (+72.22%)
Mutual labels:  parsing
octet
A library that makes working with bytebuffers painless.
Stars: ✭ 79 (+338.89%)
Mutual labels:  parsing
libwifi
An 802.11 Frame Generation and Parsing Library in C
Stars: ✭ 27 (+50%)
Mutual labels:  parsing
tangle-rs
a collection of tools to do tangle in rust
Stars: ✭ 23 (+27.78%)
Mutual labels:  parsing
ohm-crystal
Ohm for Crystal
Stars: ✭ 69 (+283.33%)
Mutual labels:  ohm
memology
Memes - why so popular?
Stars: ✭ 32 (+77.78%)
Mutual labels:  parsing
wrangler
Wrangler Transform: A DMD system for transforming Big Data
Stars: ✭ 63 (+250%)
Mutual labels:  parsing

Ohm/S Master Build Status Coverage Status

Ohm/S is a Squeak/Smalltalk implementation of the metaprogramming framework Ohm. It currently reflects the state of Ohm/JS from around version v0.86. A notable difference is that there are currently no parameterized rules and actions. Beside that, Ohm/S changes the lookup of rules from supergrammars from compile-time to matching-time. Further, Ohm/S grammars can be installed as meta-objects in the Smalltalk image similar to Smalltalk classes.

How to install

  1. Get Squeak 4.6 or later
  2. Load Metacello
  3. Finally, load Ohm/S with the following command:
Metacello new
  baseline: 'Ohm';
  repository: 'github://hpi-swa/ohm-s/packages';
  load.

Usage

For detailed information and tutorials on the Ohm grammar descriptions please consult Ohm.

In general, Ohm/S provides the same features Ohm/JS provides. The Ohm grammar language remains unchanged and Ohm/JS grammars can be used in Ohm/S without modifications as long as they do not contain paramterized rules. To make use of the image concept, grammars can additionally be installed permanently in the image. Further, the specification of semantics is adjusted to match the language concepts of Smalltalk.

Persisted and Common Grammar Interface

Ohm/S allows to create grammars as ordinary objects:

OhmGrammar new: 'G { 
  start = "a"
  anotherRule = start start
}'

The interface also allows grammars to be persisted into the image, similar to the way Smalltalk classes are persisted:

OhmGrammar install:  'G { 
  start = "a"
  anotherRule = start start
}'

This will create a class with the name G in the package 'Ohm-Grammars'. It represents the grammar and it understands all messages an Ohm grammar will understand. This class also contains the Ohm grammar language representation of the grammar, which can be found in the class method serializedGrammar. You can move this class to your own package and put it under version control.

Ohm/S Semantics Definition

As Ohm/S is currently based on a previous version of Ohm/JS the semantics are still separated into SemanticActions, InheritedAttributes and SynthesizedAttributes. To implement one of them in Ohm/S, you can subclass the class with the same name. The semantics for specific rules are implemented in methods with the following naming scheme.

For synthesized attributes and semantic actions, the first keyword of the method name has to be a camel case version of the rule name with the capitalization of the first character matching the capitalization of the first character of the rule name (hyphens and underscores are removed and the word after them is capitalized). The argument to this first keyword is the node which is currently augmented. After the first one, there has to follow one keyword for each subexpression with an arbitrary name.

SimpleSemantics>>start: aNode onePrimitive: primitiveValue
  ^ aNode interval contents

An attribute can be recursively evaluated by sending the message value to the attribute itself:

SimpleSemantics>>anotherRule: aNode start1: firstStart start2: secondStart
  ^ (self value: start1) , (self value: start2)

How to cite this work

If you did work based on / or build with Ohm/S and want to write about the work, you can reference Ohm/S through the reference at the bottom.

As Ohm/S is a mere Smalltalk adaptation of Ohm you should also reference Ohm, which you can do using the second reference.

@inproceedings{rein_gramada_2016,
  author    = {Patrick Rein and
               Robert Hirschfeld and
               Marcel Taeumel},
  title     = {Gramada: Immediacy in Programming Language Development},
  booktitle = {Symposium on New Ideas, New Paradigms, and
               Reflections on Programming and Software (Onward!) 2016},
  pages     = {165--179},
  year      = {2016},
  month     = {November},
  location  = {Amsterdam, The Netherlands},
  crossref  = {DBLP:conf/oopsla/2016onward},
  url       = {http://doi.acm.org/10.1145/2986012.2986022},
  doi       = {10.1145/2986012.2986022}
}

@inproceedings{warth_modularSemanticActions_2016,
  author = {Alessandro Warth 
            and Patrick Dubroy 
            and Tony Garnock-Jones},
  title = {Modular Semantic Actions},
  booktitle = {Proceedings of the Symposium on Dynamic Languages (DLS) 2016},
  series = {DLS 2016},
  year = {2016},
  isbn = {978-1-4503-4445-6},
  location = {Amsterdam, Netherlands},
  pages = {108--119},
  numpages = {12},
  url = {http://doi.acm.org/10.1145/2989225.2989231},
  doi = {10.1145/2989225.2989231},
  acmid = {2989231},
  publisher = {ACM},
  address = {New York, NY, USA},
} 
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].