• 0

Looking for a scriping language with a tiny footprint


Question

Hey guys. I'm currently looking for a scripting language with a tiny footprint (less than 3KB RAM and a binary that when compiled is less than 20/30KB).

All I need is the ability to evaluate statements similar to first order logic.

For example: !(x : X | x > 5)

Would mean that "for all x in the set X, return true if all xs are greater than 5, otherwise return false".

I need the ability to define functions that would return these sets (The ability to define X and pass parameters to that function that returns a set).

It would also need to be able to support a limited form of structures, where an attribute could be obtained on a certain variable (eg. x.count).

As for data types, integer, floating point and sets are about all I need. Anything else would probably be ripped out to save space.

It needs to be written in C and the ability to compile on old versions of GCC (3.4.x) would also be useful.

Anyone got any ideas? Ideally I don't want to have to write this myself.

4 answers to this question

Recommended Posts

  • 0

Your requirements are quite strict and I'm not sure that this suggestion meets them completely, but it sounds like you are describing close to the ideal use case for bc, the arbitrary precision calculator language. You can download the source code for the latest version from the GNU Project Archives and read the man page on die.net.

Edit: Although BusyBox does not include bc, you could probably accomplish what you are looking for using the combination of sh, awk, and grep it includes, albeit much less elegantly. BusyBox also gives you the option of selecting features at compile time, so you could choose not to include features you don't need.

  • 0

I'm using this on an embedded system, so it lacks anything like sh, awk or grep. There isn't really an OS... my code gets compiled when the OS code gets compiled.

This also means that there is no notion of running different executables, so no ability to run sh, awk or grep. (At least the platform gives support for proto-processes, or pseudo-processes or whatever it calls them)

Thanks for bc, I'll have a look into it.

Its a shame that if I do have to write it myself, I can't even use bison or flex because of code size issues.

  • 0

If this is for a proprietary system where you can't use GPL'd code, you can try the FreeBSD implementation of bc instead of the GNU version I linked to in my last post. Its less featureful than the GNU version, but that may not matter, depending on how much of the functionality you actually need. (And, most importantly, its BSD licensed.)

PS: I feel your frusturation with limited ROM space for embedded development. I have hit the limit on the PIC18F242 and ATMEGA328P many times.

  • 0

GPL code is perfectly fine for me, its all for academia so there shouldn't be an issue.

Anyway it looks like our team is just going to implement a small language. We've already got a small vm working, just need to finish the lexing, parsing and compiling.

This topic is now closed to further replies.
  • Posts

    • Astra 0.6.1 Beta by Razvan Serea Astra is an audiophile music player designed for local music libraries, supporting MP3, FLAC, WAV, AAC, OGG, M4A, OPUS, WMA, AIFF, and more via FFmpeg. It offers gapless playback with pre-buffering, multichannel audio remapping, and Dolby Atmos decoding, ensuring albums play seamlessly while maintaining high-fidelity sound. Astra features real-time DSP visualizers powered by a native C++ engine, including an oscilloscope, spectrum analyzer, and vectorscope. A fully parametric 10-band EQ with live frequency response, built-in presets, and AutoEQ headphone calibration import lets you precisely shape your sound. Playback controls include shuffle, repeat, and drag-and-drop queue management, while the library automatically extracts metadata, album artwork, and supports global search, favorites, and recently played tracking. Additional features include output device selection, delay calibration, customizable themes, fullscreen and mini-player modes, Discord Rich Presence, optional Last.fm scrobbling, and an opt-in local API for integrations. Astra delivers a complete, high-quality desktop audio experience with no telemetry, accounts, or streaming. Astra 0.6.1 Beta changelog: Lyrics Initial XLRC support via @boof2015/xlrc 0.2.0 (#131) XLRC sidecar scanning, manual import, and renderer support Word timing, furigana, translations, voice labels, and translation-priority controls for XLRC Fullscreen lyrics overhaul with additional layout polish Manual lyrics editor with LRC, XLRC, and plain-text modes Drag-and-drop lyrics import plus sync offset controls Clickable synced lyrics for seeking, with popout and transport lyrics updates (#138) Fixed lyrics info sidebar scrolling (#138) Added a workaround for LRCLIB instability Metadata & Library Metadata editor rebuilt as a side panel Virtual DB metadata overrides and optional direct file tag writing Bulk metadata editing for title, artist, album, album artist, genre, year, track/disc numbers, and artwork Undo/redo support for virtual metadata edits Clear overrides action and default save-mode preference Artist page grid view added, with later design and sizing refinements Improved Jump to Playing with smart source, queue, album, artist, and library track targets Fixed smart source jump behavior Playlists Fixed VLC-style M3U import failures (#127) Added playlist export to M3U/M3U8 (#118) Improved imported playlist path resolution and missing-entry preservation Shuffle added to playlist pages (#121) Remove tracks directly from playlist views (#128) Fixed create-playlist-from-track modal closing when clicking inside it (#137) Multi-select quality-of-life fixes Right-click context menus no longer clear multiselections UI & Navigation Fixed UI scaling regressions in sidebar and home surfaces (#122, #123) Fixed transport bar regression (#126) Fixed horizontal scrolling on Home and Library rails Fixed artist grid sizing while searching Updated playlist action buttons and related layout polish Additional fullscreen lyrics visual adjustments Visualization Scopes and visualizers now respect UI scaling settings (#155) Added shared canvas sizing logic for correct DPR/backing-store behavior Canvas sizing tests added for visualizer scaling regressions Discord RPC Discord Rich Presence activity structure refactored Compact status can prioritize title or artist Profile info line can show file info or album Title and artist links can target YouTube Music, Last.fm, or be disabled Optional small Astra badge for cover-art presence Configurable “clear when paused” timing Added Discord activity tests Scrobbling Fixed custom Last.fm2 API profiles being accidentally blocked Expanded scrobbler profile protocol handling coverage Stability & Tests Added/expanded tests for XLRC parsing, lyrics presentation, metadata editor state, playlist import/export path handling, artist grid layout, horizontal scrolling, canvas sizing, and Discord RPC activity building Download: Astra 0.6.1 Beta | 138.0 MB (Open Source) View: Astra Home Page | Github | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • How does it compare to the "SeeStar S30 Pro" and the "Vespera PRO 2"?
    • Indeed. And note that those units are MUCH cheaper than this new Steam Machine...ahem.
    • Microsoft have found a way to convert RAM and SSDs into water.
  • Recent Achievements

    • Week One Done
      Almohandis earned a badge
      Week One Done
    • Rookie
      dorf went up a rank
      Rookie
    • First Post
      mike_rumble earned a badge
      First Post
    • Dedicated
      tuben earned a badge
      Dedicated
    • Week One Done
      mnsgroup earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      502
    2. 2
      +Edouard
      209
    3. 3
      PsYcHoKiLLa
      100
    4. 4
      Michael Scrip
      84
    5. 5
      neufuse
      69
  • Tell a friend

    Love Neowin? Tell a friend!