• 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

    • Never used the G7 Pro, but I've never had a good experience with that style of d-pad and fighting games.
    • And I just bought a seat cushion for my mesh chair. The chair feels nice but the first time I sat in it with boxers, I realized I don't like the feel of mesh on my legs. 😂
    • "This Dell 27 inch 4K 120Hz IPS monitor is really cheap after a very long time" ... Lol.
    • This Dell 27 inch 4K 120Hz IPS monitor is really cheap after a very long time by Sayan Sen Recently we covered a really good deal on an AMD RX 9070 three-fan model that's available at slightly above its MSRP. If you are looking for a GPU for 1440p gaming that's around the performance of the Nvidia RTX 5070 you should most definitely check it out. Let's say that you are looking for a monitor to pair that up with too. The Samsung 49" G9 curved QD-OLED superultrawide is a good option that can provide an immersive experience. However despite being a very good deal currently (at $855), it may seem unaffordable to you, or you may simply not want to spend as much on a monitor. In that case Dell's S2725QS can be a very good option as it's on sale at the moment for its lowest price in over six months (purchase link under the specs table down below). The big highlight of the Dell S2725QS is its 27-inch IPS panel with a 3840 x 2160 (4K UHD) resolution, offering a high pixel density that can make text appear sharper while also providing plenty of screen space for productivity and media consumption. The display supports a refresh rate of up to 120Hz through both HDMI and DisplayPort, making it suitable not only for everyday desktop use but also for smoother gaming and scrolling. AMD FreeSync Premium support is included as well, helping reduce screen tearing during gaming sessions. The screen has fairly good brightness and color accuracy so you can use it for general work purpose, though photo/video editing is probably not going to be the best match for this. The technical specs of the Dell S2725QS are given in the table below: Specification Value Viewable Screen Size 27 in (68.58 cm) Screen Mode 4K UHD Maximum Resolution 3840 × 2160 Maximum Preset Resolution 3840 × 2160 @ 120 Hz Standard Refresh Rate 120 Hz Panel Technology In-plane Switching (IPS) Backlight Technology LED Edgelight System Pixel Density 163 PPI Response Time 8 ms GTG, 5 ms GTG, 4 ms GTG Horizontal Viewing Angle 178° Vertical Viewing Angle 178° Brightness 350 cd/m² (nits) Native Contrast Ratio 1500:1 Color Support 1.07 Billion Colors Color Gamut 99% sRGB (CIE 1931) Adaptive Sync AMD FreeSync Premium HDCP Support Yes Mount Type Panel Mount VESA Mount 100 × 100 mm Maximum Height Adjustment 13 cm Tilt -5° to 21° Swivel -30° to 30° Pivot ±90° Stand Adjustments Tilt, Swivel, Height, Pivot Glass Hardness 3H Horizontal Frequency 27–270 kHz (DisplayPort 1.4 / HDMI 2.1) Vertical Frequency 48–120 Hz (DisplayPort 1.4 / HDMI 2.1) Video Inputs 2 × HDMI 2.1 (HDCP 1.4 & 2.3), 1 × DisplayPort 1.4 (HDCP 1.4 & 2.3) Operating Temperature 0°C to 40°C Storage Temperature -20°C to 60°C Operating Humidity 10%–80% (Non-condensing) Storage Humidity 5%–95% (Non-condensing) Get it at the link below: Dell S2725QS 27-inch 4K 120Hz IPS monitor: $218.49 (Sold and Shipped by Amazon US) (Was: $280) Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases
  • Recent Achievements

    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      498
    2. 2
      +Edouard
      241
    3. 3
      PsYcHoKiLLa
      152
    4. 4
      Steven P.
      84
    5. 5
      macoman
      64
  • Tell a friend

    Love Neowin? Tell a friend!